Hello:
I have two models:
- Users
- Categories
I have successfully used this helper in the “new” and “edit” views:
<%= collection_select(:user, :cat_id, @categories, :id, :name) %>
This gets me a nice drop down list with all of my categories. But when
I look at the “show” or “index” views, the cat_id field simply lists
the id: of the category (i.e. a 1 or 2 or 3) rather than the nice
category name that is listed in the drop box (gold,silver,bronze).
I understand why this is happening, but I would like the code in that
I would use in my “index” or “show” views to get the category name
versus ID.
Right now the code is simply <%=h user.cat_id %> which gives me the
number, not the name.
Thanks in advance for the help.
-Tallp