This project is archived and is in readonly mode.

#5557 ✓resolved
Anton Astashov

Rails 3.0.0, 'yield' won't show block contents in render :layout, if it is placed after render :partial

Reported by Anton Astashov | September 5th, 2010 @ 03:03 PM | in 3.0.5

After migrating to Rails 3.0.0, following code doesn't work correctly anymore:

# app/views/layouts/_example_layout.html.erb
<%= render :partial => "/example_partial.html.erb" %>
<%= yield %>

# app/views/_example_partial.html.erb
<%= "It is partial" %>

# app/views/example/index.html.erb
<%= render :layout => "/layouts/example_layout" do %>
  <%= "Block's content" %>
<% end %>

It will display:

It is partial

instead of:

It is partial
Block content

Looks like the reason of the issue is reusing of the PartialRenderer object in ActionView::Partials#_render_partial method and setting up empty block of render :partial (instead of real block of render :layout) to it.

Test for the issue is attached.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>