Hi,

I am new to rails. Any support from your side would be very helpful.

I have a model called child and another model called childcategory. I
have given the code in app/views/children/show.html.erb of child.

<% remote_form_for [...@child, Childcategory.new] do |f| %>
<p>
    <%= f.label :body, " Allowed Categories " %> <br />
    <% for category in @cat do %>
       <%= check_box 'checkbox', category.categoryname %> <%=
category.categoryname %>
    <% end %>
  </p>
<p> <%= f.submit "Update Settings" %> </p>
<% end %>


NOw the check boxes are displayed from another model called
Filtercategory. When the user checks a check box in the above view, i
want the check box value to be inserted in a model called Childcategory.
The controller code is as follows.

app/controllers/childcategories_controller.rb

class ChildcategoriesController < ApplicationController

def create
     @child = Child.find(params[:child_id])
     @catlist = @child.childcategories.create!(params[:childcategory])

     respond_to do |format|
       format.html { redirect_to @child }
       format.js
    end
   end

end

But  when i submit the "Update Settings" button, a new record is created
with childid but the category name in the check box is not saved in the
table.


Can you say whats the issue. I couldnt solve this.


Any suggestion would be really supportive.
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to