Where should I store constant data and then how to reference it in Rails?
I have a array of data, for example times (7:00am, 7:30am, etc.), that I want stored and referenced in a couple places.
1) Where should I store this data? I was originally thinking in my DB (I'm using mongoid) but I'm not sure if that's over kill.
2) How would I go about referencing it? Let's say, from a drop down menu.
In this kind of situation, I create a Constants module in lib:
module Constants SCHEDULER_STEPS = %w( 7:00am 7:30am ) end
Then I access it wherever I need with:
Note: be sure to add libs to your autoload path in the configuration file.