Loading and managing reference data in Rails
- by jonnii
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?