aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2019-02-25 16:33:05 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2019-02-25 16:33:05 -0800
commit9a343d148b96874a231b87906c9d6499b5e0b64a (patch)
tree929e172f35029976508c0603f0d923321bc530c4
parentd4015a7f0609f12a5f7be4c794e5c5eaf2c748d5 (diff)
downloadrails-9a343d148b96874a231b87906c9d6499b5e0b64a.tar.gz
rails-9a343d148b96874a231b87906c9d6499b5e0b64a.tar.bz2
rails-9a343d148b96874a231b87906c9d6499b5e0b64a.zip
Don't mutate `virtual_path`, remove `decorate`
`virtual_path` is calculated in the constructor when the Template object is allocated. We don't actually need to set it in the `decorate` method. That means we can remove the decorate method all together.
-rw-r--r--actionview/lib/action_view/template.rb5
-rw-r--r--actionview/lib/action_view/template/resolver.rb16
2 files changed, 4 insertions, 17 deletions
diff --git a/actionview/lib/action_view/template.rb b/actionview/lib/action_view/template.rb
index 1070128d00..09476ceadc 100644
--- a/actionview/lib/action_view/template.rb
+++ b/actionview/lib/action_view/template.rb
@@ -122,10 +122,8 @@ module ActionView
extend Template::Handlers
- attr_accessor :virtual_path
-
attr_reader :source, :identifier, :handler, :original_encoding, :updated_at
- attr_reader :variable, :format, :variant, :locals
+ attr_reader :variable, :format, :variant, :locals, :virtual_path
def initialize(source, identifier, handler, format: nil, variant: nil, locals: nil, **details)
unless format
@@ -158,6 +156,7 @@ module ActionView
@compile_mutex = Mutex.new
end
+ deprecate def virtual_path=(_); end
deprecate def locals=(_); end
deprecate def formats=(_); end
deprecate def formats; Array(format); end
diff --git a/actionview/lib/action_view/template/resolver.rb b/actionview/lib/action_view/template/resolver.rb
index 312299b755..9ca028840f 100644
--- a/actionview/lib/action_view/template/resolver.rb
+++ b/actionview/lib/action_view/template/resolver.rb
@@ -187,18 +187,10 @@ module ActionView
if key
@cache.cache(key, name, prefix, partial, locals) do
- decorate(yield, path_info, details, locals)
+ yield
end
else
- decorate(yield, path_info, details, locals)
- end
- end
-
- # Ensures all the resolver information is set in the template.
- def decorate(templates, path_info, details, locals)
- cached = nil
- templates.each do |t|
- t.virtual_path ||= (cached ||= build_path(*path_info))
+ yield
end
end
end
@@ -432,9 +424,5 @@ module ActionView
def self.instances
[new(""), new("/")]
end
-
- def decorate(*)
- super.each { |t| t.virtual_path = nil }
- end
end
end