I am hoping for some help with constructing a form a has_many :through relationship.
I have three classes:
order.rb
has_many :selections
has_many :items, :through =>:selections;
item.rb
has_many :selections
has_many :orders, :through => :selections
selection.rb
belongs_to :order
belongs_to :item
Selections has an extra property on it to capture the quantity of the selected item.
What I'm trying to do is create a form that allows a user check a box indicating the type of item they want and supply a quantity.
_X_ Food1 _6_
___ Food2 __
_X_ Food3 _1_
My problem is that I don't have any idea how to name the form elements so that they make it into the controller. I can't use
<%= collection_check_boxes(:order, :item_ids, @course.items.all, :id, :name, {:item_wrapper_class => 'checkbox_container'}) %>
because that will just print the food with checkboxes and I need to capture the quantity for each selected item.
What I could use help with is how to create the _form.html.erb as well as special gotcha's that I might need to have in my controller.