# Problem with render :layout with yield :something inside in Rails 2.2.2

**URL:** <https://www.ruby-forum.com/t/problem-with-render-layout-with-yield-something-inside-in-rails-2-2-2/157894>\
**Category:** Rails\
**Created:** [January 16, 2009, 12:14pm UTC](https://www.ruby-forum.com/t/problem-with-render-layout-with-yield-something-inside-in-rails-2-2-2/157894 "2009-01-16T12:14:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![g0nzo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/3bc359/32.png) [@g0nzo](https://www.ruby-forum.com/u/g0nzo)\
**Post date:** [January 16, 2009, 12:14pm UTC](https://www.ruby-forum.com/t/problem-with-render-layout-with-yield-something-inside-in-rails-2-2-2/157894/1 "2009-01-16T12:14:48Z")

</div>

Hi,

I got something like this:

\_inner\_layout.erb.html  
\<%= yield %\>  
\<%= yield :sidebar %\>

index.erb.html  
\<% render :layout =\> “inner\_layout” do %\>  
should be rendered only once  
\<% end %\>

After switching from Rails 2.1 to 2.2 the code above renders “should  
be rendered only once” twice. If I add:  
\<% content\_for :sidebar do %\>  
\<% end %\>

then everything is ok.
