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