Ruby on Rails Naming Conventions Models


Example

The model is named using the class naming convention of unbroken MixedCase and is always the singular of the table name.

For Example: If a table was named orders, the associated model would be named Order

For Example: If a table was named posts, the associated model would be named Post

Rails will then look for the class definition in a file called order.rb in the /app/models directory.

If the model class name has multiple capitalized words, the table name is assumed to have underscores between these words.

For Example: If a model is named BlogPost then assumed table name will be blog_posts.