Here is what I think that's happening;
* rails boots and start loading its template files into memory
* method calls to Template.source (that loads the template from disk)
and Renderable.compiled_source are memoized so it stores the result of
those methods
* by deleteing the necessary CompiledTempaltes, the compiled_source is
being reloaded the next time the template is requested
* since compiled_source is aliased by memoization, its is now replaced
with a static method, thus it won't reload the Template.source
* by quoting the "memoize :compile_source" line, the original method
will get triggered, and now calls the source method on the template
* but that's also memoized, so by unquoting that, I get the result
that I need
I'm going to look further into this and hopefully let you know what
solution I'll find :-D
Thanks for your help so far.
On Feb 7, 11:45 am, Sven Fuchs <
svenfu...@artweb-design.de> wrote:
> Ah, sorry!
>
> I should have mentioned that this worksforme on Rails 2.2 (so we've
> had similar issues to yours when porting from Rails 2.1). We haven't
> tried porting to Rails 2.3, yet, although we plan to do so soon.
>
> On Rails 2.2 I haven't seen any problems with memoizing here. But
> perhaps I'm still missing something.
>
> On 07.02.2009, at 10:45, Stijnster wrote:
>
>
>
> > Hi Sven,
>
> > thanks for pointing me in the right direction. I use a slightly
> > different caching method, once the user logs out of the backend, 30
> > minutes later the cache (page caching) starts kicking in. So I added a
> > method to my site_controller which looks like this;
>
> > def clear_templates
> > ActionView::Base::CompiledTemplates.instance_methods(false).each
> > do |method|
> > if method =~ /4...@project.code}47/ # 47 is the ord of /, rails
> > encodes methods that way
> > ActionView::Base::CompiledTemplates.send(:remove_method,
> > method)
> > end
> > end
> > RAILS_DEFAULT_LOGGER.info("Cleared all compiled views from cache
> > for project '...@
project.name}'")