Revisiting the Rendering Stack

In ​Understanding the Rails Rendering Stack​, we saw that the main responsibility of the Rails controllers rendering stack is to normalize options and send them to an instance of ActionView::Renderer. When invoked, the renderer receives an instance of ActionView::Base called the view context, and a hash of normalized options used to find, compile, and render a specific template.

Whenever we render a template in Rails, its source must first be compiled into executable Ruby code. Every time some Ruby code is executed, its execution happens inside a given context and, in a Rails application, views are executed inside the view context object. All helpers available in our templates, such as form_for and link_to ...

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.