Which is the best way to create a thin key/value related to some
model? where a field only could insert those values (keys as 0,1) and
where could be showed the values (as Red, Blue) from a drop-list
Which is the best way to create a thin key/value related to some
model? where a field only could insert those values (keys as 0,1) and
where could be showed the values (as Red, Blue) from a drop-list
I will say that I would prefer to just store the actual values (“Red”,
“Blue”, etc.) or if you want to store numeric keys, then create an
actual
table and setup an association.
class Whatever < ActiveRecord::Base
belongs_to :colour
end
class Colour < ActiveRecord::Base
has_many :whatevers
end