Q:

rails 3 partial content_for not showing up

I have a layout (application.html) that has this:
<!-- then anything added in the views -->
<%= yield :stylesheet %>

If I put this code in a 'root' template (ie the one called by an action directly) it renders on the page no problem:
<% content_for :stylesheet do %>
This is a test
<% end %>

But if I put the same thing in a partial it doesn't get rendered. The partial is rendered as such:
<%= render :partial => "detail" %>

A:

Without seeing rest of the related code it is hard to know for sure but it could be an ordering problem.
From a high level, when the page renders, it first loads the view (before the layout) and any partials in the view with content_for should work correctly.  However if this partial is being rendered in the layout instead of the view template, there is a chance the content_for will be called after the "yield :stylesheet" which would cause it to get ignored.

