jeudi 17 décembre 2015

Rails - How to display description from lookup table in view

I have a very simple question I'm sure. I have a table of static data containing a code and a description:

Code=A, Description=Table

Code=B, Description=Chair

Code=C, Description=Desk

The static data is maintained by users in a "Item Types" form. This has its own model/object/views.

I have another model "Items" where I store the Code. If I want to display the Description in the Jobs view, how can I do this please? As it currently stands, my view has:

<td><%= p.item_type %></td>

which displays "A" instead of "Table".

Thanks

Aucun commentaire:

Enregistrer un commentaire