Ask the view for its method container

Rather than doing is_a? checks, ask the view object for its compiled
method container.  This gives us the power to replace the method
container depending on the instance of the view.
上级 195f3980
......@@ -224,6 +224,10 @@ def run(method, locals, buffer, &block)
@output_buffer, @virtual_path = _old_output_buffer, _old_virtual_path
end
def compiled_method_container
CompiledTemplates
end
ActiveSupport.run_load_hooks(:action_view, self)
end
end
......@@ -264,11 +264,7 @@ def compile!(view)
# re-compilation
return if @compiled
if view.is_a?(ActionView::CompiledTemplates)
mod = ActionView::CompiledTemplates
else
mod = view.singleton_class
end
mod = view.compiled_method_container
instrument("!compile_template") do
compile(mod)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册