# Has\_many :through two way multiple select

**URL:** <https://www.ruby-forum.com/t/has-many-through-two-way-multiple-select/111364>\
**Category:** Rails\
**Created:** [August 6, 2007, 3:38pm UTC](https://www.ruby-forum.com/t/has-many-through-two-way-multiple-select/111364 "2007-08-06T15:38:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jkanta1](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ebca7d/32.png) [@jkanta1](https://www.ruby-forum.com/u/jkanta1)\
**Post date:** [August 6, 2007, 3:38pm UTC](https://www.ruby-forum.com/t/has-many-through-two-way-multiple-select/111364/1 "2007-08-06T15:38:16Z")

</div>

I’m trying to generate a form that uses has\_many :through and multiple  
selects. I’m working directly with the join table controller and  
working with edge rails. I want to generate a list to populate the  
join table without doing one step over and over again. When items are  
successfully created they contain the wrong information (Only a single  
entry and 1 for both join id values. Here’s the code:

Applicable Units

All  
\<%=  
option\_groups\_from\_collection\_for\_select(Familytype.find(:all, :order  
=\> “name”, :conditions =\> “parent\_id IS NULL and name != ‘all’”),  
“children.find(:all)”,  
“name”, “id”, “name”)%\>

\<%=  
collection\_multiple\_select(  
‘connection’, ‘producttest\_id’, Producttest.find(:all, :order =\>  
“name”, :conditions =\> “parent\_id \> 0”), :id, :name  
)  
%\>  
######################################  
and the dump:

undefined method `producttest\_ids=’ for #\<Connection id: nil,  
familytype\_id: 1, producttest\_id: 1\>

vendor/rails/activerecord/lib/active\_record/base.rb:2028:in  
`method_missing' app/controllers/connection_controller.rb:30:in`create’  
-e:4:in `load’  
-e:4

Request

Parameters:

{“commit”=\>“Create”,  
“connection”=\>{“producttest\_id”=\>[“3”,  
“13”,  
“14”],  
“familytype\_id”=\>[“10015”,  
“7”,  
“5”,  
“9”]}}

######################################  
I would like to see the following generated from the above

Join table:  
3 10015  
3 7  
3 5  
3 9  
13 10015  
…  
14 5  
14 9  
######################################

Response

Headers:

{“cookie”=\>[],  
“Cache-Control”=\>“no-cache”}  
######################################
