Chapter 4. Controllers

Controllers put the C in MVC and are a fundamental part of the Rails framework. However, the relationship that many Rails programmers have with controllers is complex.

On one hand, controllers are categorically loathed, with most Rails programmers having the goals that as little code as possible should go into controllers and that controllers should all be pretty much the same auto-generated scaffolding.

On the other hand, there is an intense focus on controllers—so much so that the aforementioned goals have been an immense source of abstraction and innovation in Rails, allowing programmers to write more functionality with less code.

In fact, in the 2.x Rails releases, the most fundamental changes came to controllers ...

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.