<%= content_for :footer %> is mentioned in the docs (capture_helper.rb:
121), but is not valid at this point. I provided a simple patch below,
but there should probably be some discussion.
http://dev.rubyonrails.org/ticket/11402
Any thoughts on how these two instances should be treated differently?
<% content_for :footer, @footer_content %> vs.
<%= content_for :footer, @footer_content %>
I have a more thorough exploration in the ticket.
Stephen
Perhaps that's just a typo in the docs? I always thought content_for
stuffed the data in a @content_for_* ivar for use elsewhere in the
template or layout. I don't think it should also output the data.
Yeah, I mentioned the possibility of a typo in the ticket, which would
somewhat resolve things, though the behavior still isn't completely
clear in the documentation: I can especially see people new to the
framework making mistakes with <%=.
Stephen
Aren't you meant to use:
<%= yield :footer -%>
In order to get anything you've stored in <% content_for(:footer) -%> out?
Or am I missing the point?
Yes, you are meant to do so, but the documentation is confusing in the
discussion of declaring that content to begin with. This especially:
<%= content_for :footer %>
Two problems:
1. Uses an "=" ERB tag.
2. Doesn't declare any content.