# Multi Select and Virtual Attributes

**URL:** <https://www.ruby-forum.com/t/multi-select-and-virtual-attributes/177640>\
**Category:** Rails\
**Created:** [October 21, 2009, 1:18pm UTC](https://www.ruby-forum.com/t/multi-select-and-virtual-attributes/177640 "2009-10-21T13:18:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![acgreen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/3bc359/32.png) [@acgreen](https://www.ruby-forum.com/u/acgreen)\
**Post date:** [October 21, 2009, 1:18pm UTC](https://www.ruby-forum.com/t/multi-select-and-virtual-attributes/177640/1 "2009-10-21T13:18:48Z")

</div>

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 Test

which 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.
