2009/5/7 Andrew Porter <[email protected]> > > Vipin wrote: > > in a database table if there is a field which has a certain set of > > fixed values. for example > > staus => {Single, Married, Divorced } > > OR > > state => {California, Albama, Olaska ...} > > > > so what should be preferred way out of the following for storing the > > values > > I use ENUM() columns in mysql - rails treats them as strings so > everything works (apart from schema dumps) >
Sorry, I misunderstood the question, I assumed you wanted to know how to store the country names in a countries table. I did not realise that in option 1 you meant storing the string in every record that references country, though that is what you said, I did not read it carefully. Now that I understand, I would suggest some variant of option 2, store an id in each record referencing a country and determine the string by an enumeration or table lookup later. Worrying too much about computing time during development is a mugs game, an application always ends up with most of its computing time in an area you do not expect. Worry about optimisation later when (or more likely if) a particular area becomes a problem. 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 -~----------~----~----~----~------~----~------~--~---

