From 0f081611e6746ebbf17ffc13e119b24c9ad7aa73 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Fri, 18 Jan 2019 15:54:37 -0800 Subject: 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. --- actionview/lib/action_view/base.rb | 4 ++++ actionview/lib/action_view/template.rb | 6 +----- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'actionview/lib/action_view') diff --git a/actionview/lib/action_view/base.rb b/actionview/lib/action_view/base.rb index 384439c8fb..6cb342a0a9 100644 --- a/actionview/lib/action_view/base.rb +++ b/actionview/lib/action_view/base.rb @@ -224,6 +224,10 @@ module ActionView #:nodoc: @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 diff --git a/actionview/lib/action_view/template.rb b/actionview/lib/action_view/template.rb index e86a49f222..8ce8053011 100644 --- a/actionview/lib/action_view/template.rb +++ b/actionview/lib/action_view/template.rb @@ -264,11 +264,7 @@ module ActionView # 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) -- cgit v1.2.3