views:

27

answers:

1

This is more of a design question. I have several places in models were I have records that have only a certain amount of option for them, for example:

Sex: There is only 2 options (male, female)
Level: There is only 3 options (silver, gold, platinum)
Country: There is only a limited amount of countries.

My question is what is the right type for this type of records, t.string or t.integer.

Of course with t.integer there needs to be a enumeration, but does speed up when determining the type, although it makes code a little more complex, is this worth optimizing ?

+1  A: 

As long as you have it indexed there normally isn´t much point in optimizing.

I´ve been using this gem: http://github.com/jeffp/enumerated_attribute for over a year

glebm