Using Rails 2, I have multiple objects in a form and am using
fields_for. My
problem is creating a multi select and sending that off to the
controller as
a hash.
In my erb, I have …
<% teacher.fields_for :qualifications do |qual_form| %>
<%= qual_form.select [], @qualifications, { :multiple => true, :size
=>
5, :disabled => false } %>
which produces a non-multi select …
Licence NPLQ Teacher's Level One Teacher's Level Two Teacher's Rescue Testwhich sends “qualifications”=>[“5”] to the controller and not
qualifications"=> { [“5”] }
The HTML produced looks almost right but isn’t. I can send a hash of
information with a <%= qual_form.text_field :id %> for example but I
need a
select.
I’ve tried select_tag and although I’m able to get a multi select going
on,
I still can’t send a hash.
<%= select_tag “teacher[qualifications][]”, options_for_select(
@qualifications, @selected_qualifications ),
{ :multiple => true, :size => 5, :disabled => false,
:id
=> “qualifications” } %>
Can someone help me, please.
Thank you
–
100% naturally selected. 0% designed.