It assumes the existence of certain database columns.
The first assumption of an Active Record class is the table name.
In the case of our Account class, the table Active Record assumes is accounts. It makes this assumption based on the following guidelines:
The name of the table within the database is the pluralized name of the class defined in your Active Record program.
The table name is in lowercase.
If the class name includes multiple words that begin with capital letters, the words will be separated by underscores in the table name.
Examples of Active Record Table Pluralization
Class Name Table Name
Account accounts
Person people
UserImage user_images
Address addresses
Currency currencies
Mouse mice
In addition, Active Record also assumes that each table has an automatically
incremented integer primary key column named id.
|