title: Rails 3 and partials layouts
body: <p>I'm trying to render a collection of different objects in a same format for each. I want to keep it DRY, so I want to use partials and <a href="http://guides.rubyonrails.org/layouts_and_rendering.html#partial-layouts" rel="nofollow">partial layouts</a>.</p>
  
  <p><em>Edit - brief clarification : That I need is not to display common items on all publication pages, but to display common properties/fields on each item. This is why I need partial layouts e.g. a layout for the the partial, not a layout for the page.</em></p>
  
  <p>I have a collection of different objects :</p>
  
  <pre><code>@publications = Publications.all
  # Publication is the parent class
  # @publications = [ImagePost, VideoPost, TextPost, ...]
  </code></pre>
  
  <p>I want to render all publications in a list. Each publication have some common properties : author, date, ... I want to put this properties in a <em>partial layout</em>.</p>
  
  <p>So in my view, to render the collection, I do :</p>
  
  <pre><code>&lt;%= render :partial =&gt; 'publications', :locals =&gt; {:publications =&gt; @publications} %&gt;
  </code></pre>
  
  <p>In the first level partial <code>views/publications/_publications.html.erb</code>, I loop on the item and try to render each item in its partial and with a common partial layout :</p>
  
  <pre><code>&lt;ul class='publications_list'&gt;
    &lt;% publications.each do |p| %&gt;
      &lt;%= render p, :layout =&gt; 'publications/publication_layout' %&gt;
    &lt;% end %&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>The partial layout, <code>views/publications/_publication_layout.html.erb</code> :</p>
  
  <pre><code>&lt;li&gt;
    &lt;h2&gt;&lt;%= link_to publication.title, publication %&gt;&lt;/h2&gt;
    ... Other common properties that I want to display on each item, independently of its type ...
    &lt;p&gt;&lt;%= yield %&gt;&lt;/p&gt;
  &lt;/li&gt;
  </code></pre>
  
  <p>And finally for each object type, I have a partial (e.g. <code>image_posts/_image_post.html.erb</code> and so) containing the code to display properly each.</p>
  
  <p>My problem : I don't manage to render each publication in the common partial layout <code>publication_layout</code>. This layout is simply ignored by rails. Each item is correctly rendered but without this layout which include the common properties and the <code>&lt;li&gt;</code> tag.</p>
  
  <p>Any suggestion about why my <em>partial layout</em> is ignored ?</p>