Partials and content_for

let’s say i’ve got a partial that looks like this:

<% content_for :foo do -%>
partial.id
<% end -%>

then the following works:
<%= render :partial => “partial”, :collection => @collection %>
<%= @content_for_foo %>

but this does not:
<%= @content_for_foo %>
<%= render :partial => “partial”, :collection => @collection %>

is there any way to get my @content_for to show up in the html output
above where the partial is rendered in the rhtml template?

thanks