Understanding the Rails Rendering Stack

Action Mailer and Action Controller have several features in common, such as template rendering, helpers, and layouts. To avoid code duplication, those shared responsibilities are centralized in Abstract Controller, which both Action Mailer and Action Controller use as their foundation. At the same time, some features are required by only one of the two libraries. Given those requirements, Abstract Controller was designed in a way that developers can cherry-pick the functionality they want. For instance, if we want an object to have basic rendering capabilities, where it simply renders a template but does not include a layout, we include the AbstractController::Rendering module in our object, leaving out ...

Get Crafting Rails 4 Applications, 2nd Edition 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.