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 )

Then I access it wherever I need with:


Note: be sure to add libs to your autoload path in the configuration file.

Need Your Help

One web service per module, or one web service overall?

.net flex web-services

I'm doing a flex application that has tons of screens (each very different, can't reuse :( ), and tons of web methods in .net.

Windows Phone 7: Build a music alarm clock?

windows-phone-7 push-notification windows-phone mpns

I'd like to create an app for the Windows Phone 7 that plays a song at a user-specified time. My idea was to use push notifications to trigger the app to play some content on the device. However, I...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.