In my application i have a collection_select on my members table, the members table only contains id’s. It has an user_id, project_id, role_id, and so on.
I want show the members name in the collection_select. But i only have the user_id in the members table, how can i show the names from the user table as options?
<%= collection_select(nil, :member_id, members, :id, :user_id,
{:prompt => "Select a member"}) %>
Now the select box shows the options 1,2,3,4, and so on. it needs to be name1, name2, from the user table.
Does any one has experiance with this?
First of all you need to add a new method to your members model:
Then change the
text_methodargument tomember_name: