Ruby on Rails - Models in ruby on rails- ruby on rails tutorial - rails guides - rails tutorial - ruby rails
Models in Ruby on Rails
The model is named using the class naming convention of unbroken MixedCase and is always the singular of the table name
Example:
If a table was named orders, the associated model would be named Order
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.
Example:
If a model is named BlogPost then assumed table name will be blog_posts.