# Collection\_select problem

**URL:** <https://www.ruby-forum.com/t/collection-select-problem/115601>\
**Category:** Rails\
**Created:** [September 26, 2007, 6:40pm UTC](https://www.ruby-forum.com/t/collection-select-problem/115601 "2007-09-26T18:40:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![joel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9bd4f/32.png) [@joel](https://www.ruby-forum.com/u/joel)\
**Post date:** [September 26, 2007, 6:40pm UTC](https://www.ruby-forum.com/t/collection-select-problem/115601/1 "2007-09-26T18:40:47Z")

</div>

I have an “Installation” model with the following associations to the  
“user” model

belongs\_to :user\_id, :class\_name =\> “User”, :foreign\_key =\>  
“user\_id”  
belongs\_to :assigned\_id, :class\_name =\> “User”, :foreign\_key =\>  
“assigned\_id”

When creating a new installation, the user\_id is set to the current  
user, but i have a collection\_select that i am using to choose the  
user ,from the same user table, that will be assigned to the  
installation under assigned\_id.

Assigned Technician:  
\<%= collection\_select(:installation, :assigned\_id,  
@users, :id, :name) %\>

When i create it though i get the error “User expected, Got string”, i  
assume because it is passing the id from the selected user as a string  
to the assigned\_id field when it should be passing a user object?  
How can i get this collection select to populate the assigned\_id field  
with the user object and not the string of the selected id, or what do  
i have to do to make this work???

Thanks!  
Joel
