On Jun 11, 2012, at 4:45 PM, Matt Martini wrote:

> Hello,
> 
> What is the best way to to do enumerations of values that you want to use to 
> provide values for a field.  There are many cases where you want the user to 
> choose from a list of values, but you really don't need a whole model to 
> support.  Yet, it should be flexible enough to able to be changed.
> 
> A simple example would be a gender field in a person record.  There needs to 
> be somewhere to store the 'male' and 'female' values to be used in a select 
> field,
> but we don't want to hard code these values because later we might add 
> 'unknown' as an option, or change to 'boy' and 'girl'.  With only two values 
> it seems pointless to have a whole model dedicated to this, yet it still 
> needs to be somewhat dynamic as the values could change.
> 
> What is the best practice for this type of data?

I don't know about best practice, but I often stick these in global vars, 
usually in the application.rb file or similar.

Walter

> 
> Matt
> 
> 
> -- 
> 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.
> 

-- 
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.

Reply via email to