Topic: Best Practices For "Look Up Tables"

Looking to know if anyone has a best practice or "Rails Convention" for creating and managing "lookup" tables in rails. For example I have a user form. Within this "user" form there will be a drop down that is dynamic and will give the user an option to select a "Role".

So it would be nice if I knew the following.

a) Could I organize my 'model folder' in rails like this. Essentially create sub_folders in the model folder? This way when I look at my "models" folder I know what files are lookups.

    lookup (this would be a folder)

b) Is there any RAILS convention to follow for using 'lookup' tables or a  best practices especially when dealing with column_ids ? I would think there might be because it seems something that's done a lot.

Re: Best Practices For "Look Up Tables"

Typically, the models folder is flat, although I believe Rails will load .rb files in subdirectories. But, think about the way the models are named:

roles_users.rb (assuming a habtm association)

I think this is pretty descriptive. Where it gets more difficult is hm:t associations where you could have


and a user has_many :projects, :through => :assignments, a project has_many :users, :through => :assignments

The filename "assignment.rb" says nothing about it being a join model.

I think the best answer is: whatever works semantically for you.