Rails Rules of Thumb
This anonymous ranter on Joel Spolsky's forums isn't as enamored with Rails as I am -- but he makes a good point when he says that the basic naming conventions of Rails are simple, but aren't publicized as much as they could be. Here is my adaptation of his short list:
- Name your tables in the plural
- Foreign keys should always be named in the style tableNameInSingularForm_id, so user_id (foreign key) -> users (table)
- Name your models in the singular
- Controllers are plural, at least in some cases
- Many-to-many jump tables should be named in the style alphabeticallyFirstTablePlural_alphabeticallySecondTablePlural
So: axes_users
- Columns in many-to-many jump tables should be named like other foreign keys
So: axe_id and user_id
- Columns named created_on and updated_on will automatically be populated correctly
Please feel free to add your own Rails rules of thumb in the comments.