Clarification of how controllers and views work together...

Bob Hutchison hutch at recursive.ca
Sat Mar 17 10:42:18 EDT 2007


Hi Ezra,

On 12-Mar-07, at 3:01 AM, Ezra Zygmuntowicz wrote:

> 	Ok I took a look. Here is a patch for you to try before I commit  
> it to the repo. The default behavior remains the same and the  
> viewcontext is cached for subsequest renders. But if you pass  
> in  :clean_context => true  along with your render method you will  
> get a fresh context with your current ivars as you expect.
>

That worked perfectly. Thanks!

Just wondering... what do you gain by caching the ViewContext? Well,  
more precisely, when would the output of the render be different when  
using the cached ViewContext? Doesn't the ViewContext pretty much  
control the input to the rendering?  ... I suppose some of the view's  
input could be computed by calls (that changed the state of  
something, otherwise the result of the call would always be the same)  
made by the view but is that a good idea?

Cheers,
Bob

----
Bob Hutchison                  -- tumblelog at <http:// 
www.recursive.ca/so/>
Recursive Design Inc.          -- <http://www.recursive.ca/>
xampl for Ruby                 -- <http://rubyforge.org/projects/xampl/>





More information about the Merb-devel mailing list