search for: captured_content_for

Displaying 1 result from an estimated 1 matches for "captured_content_for".

2010 May 05
2
Add method to get at captured content_for
...eld from within a view. However, sometimes is it useful to get to this data from within a helper (for instance to provide a default value). Calling yield from within the helper method won''t work, and accessing the @_content_for variable directly is not encouraged. Proposed solution: add a captured_content_for method so helper methods can legitimately access captured content. Add to /action_pack/lib/ action_view/helpers/capture_helper.rb # Get content previously captured with +content_for+. This is the same as calling # +yield+ inside a template except that this method can be used inside helper meth...