1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

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.
This commit is contained in:
Aaron Patterson 2019-01-18 15:54:37 -08:00
parent 195f39804a
commit 0f081611e6
No known key found for this signature in database
GPG key ID: 953170BCB4FFAFC6
2 changed files with 5 additions and 5 deletions

View file

@ -224,6 +224,10 @@ module ActionView #:nodoc:
@output_buffer, @virtual_path = _old_output_buffer, _old_virtual_path @output_buffer, @virtual_path = _old_output_buffer, _old_virtual_path
end end
def compiled_method_container
CompiledTemplates
end
ActiveSupport.run_load_hooks(:action_view, self) ActiveSupport.run_load_hooks(:action_view, self)
end end
end end

View file

@ -264,11 +264,7 @@ module ActionView
# re-compilation # re-compilation
return if @compiled return if @compiled
if view.is_a?(ActionView::CompiledTemplates) mod = view.compiled_method_container
mod = ActionView::CompiledTemplates
else
mod = view.singleton_class
end
instrument("!compile_template") do instrument("!compile_template") do
compile(mod) compile(mod)