diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2019-01-18 15:54:37 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2019-01-18 15:54:37 -0800 |
commit | 0f081611e6746ebbf17ffc13e119b24c9ad7aa73 (patch) | |
tree | 8dd399ffca85b0d350dfe9bcb4c8c105f9517782 /actionview/lib/action_view | |
parent | 195f39804a7a4a0034f25e8704220e03d95a752a (diff) | |
download | rails-0f081611e6746ebbf17ffc13e119b24c9ad7aa73.tar.gz rails-0f081611e6746ebbf17ffc13e119b24c9ad7aa73.tar.bz2 rails-0f081611e6746ebbf17ffc13e119b24c9ad7aa73.zip |
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.
Diffstat (limited to 'actionview/lib/action_view')
-rw-r--r-- | actionview/lib/action_view/base.rb | 4 | ||||
-rw-r--r-- | actionview/lib/action_view/template.rb | 6 |
2 files changed, 5 insertions, 5 deletions
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) |