On 17 June 2010 12:17, Miguel.camba <[email protected]> wrote: > In my current application, i have food categories: mexican, home made, > japanese, ect > As these categories only have ID and name, no other attributes, i dont > want to create a table on the DB. > My first idea was to create a constant named FOOD_CATEGORIES, that is > has like: > FOOD_CATEGORIES = { 1=>'mexican', > 2=>'japanese', ... } > BUT, since the hash doesn't have :id method, i dont know how to use > this constant on a collection_select in my views. > > Do you have a better idea?
Maybe options_for_select is what you are looking for. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

