hello:
I have some view code generating a list of check boxes based on the
values in a table:
<% @categories = Category.find(:all, :order => "name" ) %>
<% for category in @categories -%>
<%= check_box ("cats", "category_id", options = {},
category.id, 0 )
%> <%= category.name %><br>
<% end %>
"cats" represents a many_to_many relationship between the entity
"Category" and another entity. I''m creating "cats"
in my controller in
a new method:
The Category table contains:
id
goal_id(other entity)
category_id(the thing I''m capturing with the check boxes)
And a timestamp
In my controller, all i''m doing is:
@cats = CategoryGoal.new
@cats.goal_id = @goal.id
So what I want to happen is when the checkbox is click in the view, and
the user clicks "create" in the form, I want the value of
"category.id"
inserted into the table "Category" with goal_id. I already have
goal.id.
Where am I getting stuck? Thanks again for your help!
--
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---