Forum: Ruby on Rails using more than 1 collection_select drop down in a form

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
985e151e7f58ccc8908bfa651a8242a7?d=identicon&s=25 Matt Daviss (matt_99)
on 2007-07-26 22:26
Bashing my head off this one, done some serious googling and can;t find
an answer anywhere,

is there any way to run multiple collection selects in single form, i
have 1 working no problems, but when I try to set up a second I just get
the same values as the first one stored, I think I need an array of some
sort? But how?
D7c511ce5025d37b8c6bd9134e0f2bd9?d=identicon&s=25 Thorsten (Guest)
on 2007-07-26 22:35
(Received via mailing list)
if you use the select helper twice for the same object, both resulting
dropdowns will have the same name attribute, and therefore the value
in the params hash of one select will be overwritten by the other.

you could create the select tag yourself, giving it a different name,
and use options_from_collection_for_select to put the <options>

On 26 Jul., 22:26, Matt Daviss <>
985e151e7f58ccc8908bfa651a8242a7?d=identicon&s=25 Matt Daviss (matt_99)
on 2007-07-26 22:40
Cheers for that, what I'm trying to do is create two records with a
single subit, I have a model degree with a HABTM relationship with a
model assigned, and what I want to be able to do is to create two
assigneds on one form for a degree, so I think they need to have the
same name, just not quite sure how to submit the data and then write it
to seperate rows
This topic is locked and can not be replied to.