I''m trying to get a multi select box working with fields_for but am
having a
few problems.
My view has ....
<% form_for(@teacher) do |f| %>
<%= f.label :surname %>
<%= f.text_field :surname %>
<% f.fields_for :qualifications do |qual_form| %>
Qualifications: <%= qual_form.select( :id, @qualifications) %>
<% end %>
<%= f.submit %>
<% end %>
Which produces (for the fields_for) ......
<select id="teacher_qualifications_attributes_0_id"
name="teacher[qualifications_attributes][0][id]">
<option value="5">Licence</option>
<option value="1">NPLQ</option>
<option value="3">Teacher''s Level One</option>
<option value="4">Teacher''s Level Two</option>
<option value="2">Teacher''s Rescue
Test</option>
</select>
and on submission I have ......
"teacher"=>{"qualifications_attributes"=>{"0"=>{"id"=>"2"}},
"surname"=>""}}
but what I think I really want is a multi select box with the submitted data
looking something like ......
"teacher"=>{"qualifications_attributes"=>{"id"=>["2","3","4"]}},
"surname"=>""}}
Could somebody putme out of my misery, please?
TIA
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---