ActionView::PartialRenderer

class ActionView::PartialRenderer

Parent:
ActionView::AbstractRenderer

Action View Partials

There's also a convenience method for rendering sub templates within the current controller that depends on a single object (we call this kind of sub templates for partials). It relies on the fact that partials should follow the naming convention of being prefixed with an underscore – as to separate them from regular templates that could be rendered on their own.

In a template for Advertiser#account:

<%= render partial: "account" %>

This would render “advertiser/_account.html.erb”.

In another template for Advertiser#buy, we could have:

<%= render partial: "account", locals: { account: @buyer } %>

<% @advertise