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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
