Fandom

Ruby Wiki

Partials

26pages on
this wiki
Add New Page
Talk0 Share

Partials can be partial layouts or views which can be output, a good use of this would be to split elements you might need to repeat into their own files.

Partial Views Edit

To render a partial view you would include something like

 <%= render "menu" %>

this would load the file _menu.html.erb from your app/views folder

Partial Layouts Edit

You can render partials with their own layout

 <%= render :partial => "link_area", :layout => "graybar" %>

The code above would render the partial from app/views/_link_area.html.erb using the layout from app/views/_graybar.html.erb (not the layouts folder)

External Links Edit

RoR Guide: Using Partials

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.