Chapter 1. Models

The Model layer of your Rails application often provides the core structure of your application. Especially if you’re following a RESTful application design pattern, the structure that is initially laid out in your models will carry through to your controllers and views.

The Model layer should also contain the business logic of your application. Therefore, the models of your application will often receive the majority of developer attention throughout a project’s lifecycle.

Because so much attention is paid to the models, and because so much responsibility is contained within them, it’s relatively easy for things to get out of hand in the models as an application grows and evolves. Also, because of the powerful nature of the ...

Get Rails™ AntiPatterns: Best Practice Ruby on Rails™ Refactoring 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.