On October 6 Michael Satterwhite asked the following question:
"When the generate script creates a model, it creates a subclass of
ActiveRecord. Is this to say that every table - even pure support tables
such as a table for state codes - should have a model?"
Mario Cicio responded with:
"No, on the contrary this is to say that every model is supposed to have
a persistency attached (simple case: 1 table).
The most common case of a table not having a model attached is the "join
table" in a habtm relationship."
This created a bit of confusion for me and I'm not sure whether I just read thing wrong or what. So I thought it was time to reveal my ignorance by asking for a bit of clarification.
Let's say I have a support table, say a list of states the user can choose from. If I do not have a "State" model, how do I access the table in my controller. Without the model, I can't do State.find :first, :conditions => X, can I? How, then do I look up a state in the table? Am I just way off here, or what?
I guess I'm asking is what is the best way to handle support tables like states, cities, appointment types, etc.?