Also worth noting I am using Rails 2.3.8 not 3.
On Aug 4, 4:07 pm, Joe Fiorini <j...@faithfulgeek.org>
wrote:> Can anyone tell me how content_for concatenates content into the
> instance variable? I''ve been digging through ActionView code like
> crazy trying to find it. Here''s some context:
>
> Our system has a number of partials that render different types of
> posted items (image, file, video, etc) like so:
>
> -----------------
> meta information about the item
>
> -- optional thumbnail
> description of the item
> -- optional link
> -----------------
>
> The most elegant way to solve the problem in my mind is to use a
> layout to handle the stuff that''s similar and named content
sections
> for the stuff that differs like so:
>
> -----------------
> <%= meta information %>
>
> <%= yield :before_description %>
> description
> <%= yield :after_description %>
>
> and then in each partial use <% content_for ... %> as needed to
> control the placement of optional data.
>
> However, as the Rails docs say "Note that content_for concatenates the
> blocks it is given for a particular identifier in order." So I decided
> to try to look in the Rails source to fix it so that when rendering a
> partial with a layout it doesn''t concatenate. Why you ask? Because
if
> layouts work one way in one context (being able to use named yields
> and content_for globally) then they should work the same way in
> another context (when used as the layout for a partial). Anyone else
> have thoughts on this?
>
> Thanks!
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Core" group.
To post to this group, send email to rubyonrails-core@googlegroups.com.
To unsubscribe from this group, send email to
rubyonrails-core+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-core?hl=en.