Re: Question on Data Modeling

Suppose I want to let a user choose different languages when filling out
a
form, like English, Spanish, and Other, where Other is user-specified.

What is the best way to model this in a RoR database? Is it better to
have
a string or an integer that is converted with case-statements to mean
1=English, 2=Spanish, 3=Other…?

Thanks,
Rodrigo

On Tue, Mar 8, 2011 at 9:27 AM, J. Rodrigo Fuentes <
[email protected]> wrote:

Suppose I want to let a user choose different languages when filling out a
form, like English, Spanish, and Other, where Other is user-specified.

What is the best way to model this in a RoR database? Is it better to have
a string or an integer that is converted with case-statements to mean
1=English, 2=Spanish, 3=Other…?

If the requirement is as limited as you say than either way is fine. I
would
just stick with the string in this case because maintaining which number
equals what language is a maintenance hassle unless you have that stored
in
a database.

B.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs