diff options
author | José Valim <jose.valim@gmail.com> | 2010-09-30 11:40:51 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-09-30 11:41:53 +0200 |
commit | 6a55ca346e543e4e112648cca2a01230c32b21ec (patch) | |
tree | e3e3e46f1854b9f57b97cf00c5274134944cb765 /actionpack/lib | |
parent | 6b248f6ea56b318d39b8c28b2a9f69a7d420f1fb (diff) | |
download | rails-6a55ca346e543e4e112648cca2a01230c32b21ec.tar.gz rails-6a55ca346e543e4e112648cca2a01230c32b21ec.tar.bz2 rails-6a55ca346e543e4e112648cca2a01230c32b21ec.zip |
Revert "removing crazy finalizer code until there is proof that we need it"
This reverts commit a40e3c1a9604ab3737ad2465c8f6a6db0fe0cc78.
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_view/template.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/actionpack/lib/action_view/template.rb b/actionpack/lib/action_view/template.rb index 405e1736ba..164d177dcc 100644 --- a/actionpack/lib/action_view/template.rb +++ b/actionpack/lib/action_view/template.rb @@ -101,6 +101,16 @@ module ActionView attr_reader :source, :identifier, :handler, :virtual_path, :formats, :original_encoding + # This finalizer is needed (and exactly with a proc inside another proc) + # otherwise templates leak in development. + Finalizer = proc do |method_name, mod| + proc do + mod.module_eval do + remove_possible_method method_name + end + end + end + def initialize(source, identifier, handler, details) @source = source @identifier = identifier @@ -245,6 +255,7 @@ module ActionView begin mod.module_eval(source, identifier, 0) + ObjectSpace.define_finalizer(self, Finalizer[method_name, mod]) method_name rescue Exception => e # errors from template code |