Naming Conventions
Newcomers to Rails are sometimes puzzled by the way it automatically handles the naming of things. They’re surprised that they call a model class Person and Rails somehow knows to go looking for a database table called people. In this section, you’ll learn how this implicit naming works.
The rules here are the default conventions used by Rails. You can override all of these conventions using configuration options.
Mixed Case, Underscores, and Plurals
We often name variables and classes using short phrases. In Ruby, the convention is to have variable names where the letters are all lowercase and words are separated by underscores. Classes and modules are named differently: there are no underscores, and each word in the phrase ...
Get Agile Web Development with Rails 5.1 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.