Usually, when options for select tag was set and not dependent on data
from database, I placed key-value pairs in yml locale file. I wasn't
sure this is the right place for that. For example in ruby 1.8.7 key-
value pairs taken from locale are displayed in random order. I have
even more doubts now, when I want to implement select tag with
optgroups. Of course it's still possible to have all that data in YAML
file, but the structure is more complicated, and YAML files are not
for defining data structures.

Alternatively, I can put array of keys in corresponding model, and in
view map this keys to key-value pairs from locale file. In this
situation I can preserve order from array in model, and even write
more complex arrays for optgroups, but it looks a bit redundant. When
I want to add a new option for select, I need to modify model, and
locale.

So what is the best convention for definition of select tag options,
if they are not retrieved from database?

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to