Forum: Ruby on Rails Global Hash vs. DB-Model (...social-networking-site with profile -> eyecolour e.g.) - best practise

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
0cedd46c066dcebbba537edbd5fef613?d=identicon&s=25 Lp (Guest)
on 2009-03-05 15:15
(Received via mailing list)
Hello,

can somebody tell me what to do with static-models? Should I put them
into the DB or should I create it als normal Hash?

For example:
User has one eyecolour and he is able to choose the right value in a
view (select-box).

Should I create the select-box from an global hash or from an AR-
Model? Is there a best practise?

Thanks,
sorry for my bad english!
10bcb94f076cc6a1403fb8767a3818c8?d=identicon&s=25 Tim (Guest)
on 2009-03-05 18:32
(Received via mailing list)
If it's a list of items that will never/rarely change (gender is a
good example), it makes sense to put it in a Hash to avoid hitting the
database.

If it's something that would change frequently, it probably makes more
sense to create it as a Model and have it database driven.

A list of eye colors is probably something that won't ever change, so
I'd personally make it a Hash.
This topic is locked and can not be replied to.