mirror of https://github.com/rails/rails
Revert "removing crazy finalizer code until there is proof that we need it"
This reverts commit a40e3c1a96
.
This commit is contained in:
parent
6b248f6ea5
commit
6a55ca346e
|
@ -101,6 +101,16 @@ module ActionView
|
||||||
attr_reader :source, :identifier, :handler, :virtual_path, :formats,
|
attr_reader :source, :identifier, :handler, :virtual_path, :formats,
|
||||||
:original_encoding
|
: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)
|
def initialize(source, identifier, handler, details)
|
||||||
@source = source
|
@source = source
|
||||||
@identifier = identifier
|
@identifier = identifier
|
||||||
|
@ -245,6 +255,7 @@ module ActionView
|
||||||
|
|
||||||
begin
|
begin
|
||||||
mod.module_eval(source, identifier, 0)
|
mod.module_eval(source, identifier, 0)
|
||||||
|
ObjectSpace.define_finalizer(self, Finalizer[method_name, mod])
|
||||||
|
|
||||||
method_name
|
method_name
|
||||||
rescue Exception => e # errors from template code
|
rescue Exception => e # errors from template code
|
||||||
|
|
Loading…
Reference in New Issue