Model without database table


I'd be interested in hearing from other folks as well on how they
handle this issue. In the past, I didn't create a model, but just
documented in the model of the class that has the id (in your case
whatever has the status attribute). So at the top of the model, I
just made a little table showing me the statuses.

If you wanted to be able to programatically be able to access those
statuses, you could create a method that is just a case statement with
each of your id's. The method could be on a specific object or maybe
at the application level if you uses statuses in multiple places.

What do other people do in these cases? You would hate to hit the
database for something like this...



class Status
AwaitingReview = 1
Development = 2
Production = 3

Nothing in Rails is forcing you to use ActiveRecord::Base as the parent of your models. Of course you can do this as methods if you needed, but as you said the information won’t change, constants seems like a good fit.


Looks like this plugin might be useful to you: