Chapter 3. Models
In Rails, models represent the data in your application and the rules to manipulate that data. Models manage interactions between your application and a corresponding database table. The bulk of your application’s business logic should also be in the models.
This chapter covers Active Record, the Rails component that provides model persistence (that is, storing data in the database), as well as data validations, database migrations, and model associations. Validations are rules to ensure that only valid data is stored in the database. You create database migrations to change the schema of the database, and associations are relationships between multiple models in your application.
The Post Model
In the previous chapter, we used ...
Get Rails Crash Course 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.