Does Rails have the ability to translate a code to a literal?
I have a data table with 3 columns in it:
Id MenuItemName MenuItemType
1 Toast 2
2 Turkey 3
3 Corn Flakes 2
I have a support data table with values of:
Id MenuItemTypeDescription
1 Lunch
2 Breakfast
3 Dinner
I have set the database up with foreign keys to tie the tables together
and have added the “belongs_to” and “has_many” to the model classes.
I was hoping that rails would translate he MenuItemType to the
description for the display list and when doing and add or edit it would
have a dropdown box that would list all the MenuItemType Descriptions.
This may be just a dream.
I have searched the Rails “Agile Development” book and the Rails forums,
but I haven’t found anything on this topic.
Is this supported by the Rails framework or do you have to code this
functionality by hand?