Loading and managing reference data in Rails
Posted
by jonnii
on Stack Overflow
See other posts from Stack Overflow
or by jonnii
Published on 2009-12-18T00:00:03Z
Indexed on
2010/05/07
13:58 UTC
Read the original article
Hit count: 253
ruby-on-rails
Most of the apps I've worked on have had some kind of reference data stored in the database, for example categories, zipcodes, area codes etc... this is information that's going to change very infrequently. Most of the time you want to load some kind of display name, and that's it.
Currently this isn't causing me too many headaches, it's easy to :include the models I need when doing my queries, but going forward it causes a lot of query noise.
Ideally I'd like to load the reference data when the app starts and when referencing it in queries it'll load from the cache instead of going to the database.
What's the best way to manage this?
© Stack Overflow or respective owner