Let's look at what happens when you do something like this inside of a view:
<%= render partial: 'some_partial' -%>
To render a partial, Rails has a helper method inside of Action View. The render
method serves as a delegator and takes its input arguments and provides them to the view_renderer
object.
The view_renderer
object is initialized when ActionView::Base
is initialized and is of the ActionView::Renderer
class. This class performs all of the rendering that is necessary inside of the views. The design pattern of delegating to an object is used. When you call view_renderer.render
, you are asking the view_renderer
object to delegate the arguments of your call to another more specific object.