Ticket #127 (closed defect: fixed)

Opened 1 year ago

Last modified 1 year ago

throw_content in a partial does not throw it up the render chain

Reported by: has.s..@gmail.com Assigned to:
Priority: major Milestone: 0.4
Component: Merb Keywords:
Cc:

Description

If a template calls a partial that uses throw_content and then the template tries to access that content, it is not there.

Attachments

throw_content_from_partial_spec.diff (2.8 kB) - added by has.s..@gmail.com on 08/13/07 06:49:41.
catch_content_from_partial_fix.diff (8.7 kB) - added by has.s..@gmail.com on 08/13/07 09:15:23.
A Fix for the catch_content from partial issue

Change History

08/13/07 06:49:41 changed by has.s..@gmail.com

  • attachment throw_content_from_partial_spec.diff added.

08/13/07 09:14:55 changed by has.s..@gmail.com

  • milestone changed from 0.3.x to 0.4.

The issue is that when throw_content is called, it stores the content in an instance variable of the current view_context. Every time a partial is rendered, a new view_context object is created, and so when the partial finishes rendering, and passes control back to the containing template, the instance variables of the partials view_context object, and therefore thrown content are lost object goes out of scope.

To remedy this a cache has been added for thrown content in the controller. This is the only place I could find that is constant and accessible throughout the entire request, and has the added bonus of scoping this to only the current request since the cache is attached to the controller instance. I believe this should be thread safe since it uses the controller instance.

08/13/07 09:15:23 changed by has.s..@gmail.com

  • attachment catch_content_from_partial_fix.diff added.

A Fix for the catch_content from partial issue

08/13/07 16:25:54 changed by e.@brainspl.at

  • status changed from new to closed.
  • resolution set to fixed.

(In [412]) apply patch from has.sox for throw_content in a partial. closes #127