diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2019-03-19 18:32:31 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-19 18:32:31 -0400 |
commit | 5757c9d3c05e52cb5903bf362c752a34540d73ba (patch) | |
tree | bdf8b558a7162b6cd16f9c08ba30828b893b4bdd /actionview | |
parent | f88ea5fd7413c01796707626c890927088b88cd8 (diff) | |
parent | a4bb6fd008550824ba44fe1f52b1f2a0721f2d2d (diff) | |
download | rails-5757c9d3c05e52cb5903bf362c752a34540d73ba.tar.gz rails-5757c9d3c05e52cb5903bf362c752a34540d73ba.tar.bz2 rails-5757c9d3c05e52cb5903bf362c752a34540d73ba.zip |
Merge pull request #35670 from jhawthorn/re_add_template_updated_at
Re-add Template#updated_at as deprecated
Diffstat (limited to 'actionview')
-rw-r--r-- | actionview/lib/action_view/file_template.rb | 4 | ||||
-rw-r--r-- | actionview/lib/action_view/template.rb | 15 |
2 files changed, 13 insertions, 6 deletions
diff --git a/actionview/lib/action_view/file_template.rb b/actionview/lib/action_view/file_template.rb index d838078f94..dea02176eb 100644 --- a/actionview/lib/action_view/file_template.rb +++ b/actionview/lib/action_view/file_template.rb @@ -22,11 +22,11 @@ module ActionView # to ensure that references to the template object can be marshalled as well. This means forgoing # the marshalling of the compiler mutex and instantiating that again on unmarshalling. def marshal_dump # :nodoc: - [ @identifier, @handler, @compiled, @locals, @virtual_path, @format, @variant ] + [ @identifier, @handler, @compiled, @locals, @virtual_path, @updated_at, @format, @variant ] end def marshal_load(array) # :nodoc: - @identifier, @handler, @compiled, @locals, @virtual_path, @format, @variant = *array + @identifier, @handler, @compiled, @locals, @virtual_path, @updated_at, @format, @variant = *array @compile_mutex = Mutex.new end end diff --git a/actionview/lib/action_view/template.rb b/actionview/lib/action_view/template.rb index e733c6d376..6e3af1536a 100644 --- a/actionview/lib/action_view/template.rb +++ b/actionview/lib/action_view/template.rb @@ -122,10 +122,10 @@ module ActionView extend Template::Handlers - attr_reader :source, :identifier, :handler, :original_encoding + attr_reader :source, :identifier, :handler, :original_encoding, :updated_at attr_reader :variable, :format, :variant, :locals, :virtual_path - def initialize(source, identifier, handler, format: nil, variant: nil, locals: nil, virtual_path: nil) + def initialize(source, identifier, handler, format: nil, variant: nil, locals: nil, virtual_path: nil, updated_at: nil) unless locals ActiveSupport::Deprecation.warn "ActionView::Template#initialize requires a locals parameter" locals = [] @@ -144,12 +144,19 @@ module ActionView $1.to_sym end + if updated_at + ActiveSupport::Deprecation.warn "ActionView::Template#updated_at is deprecated" + @updated_at = updated_at + else + @updated_at = Time.now + end @format = format @variant = variant @compile_mutex = Mutex.new end deprecate :original_encoding + deprecate :updated_at deprecate def virtual_path=(_); end deprecate def locals=(_); end deprecate def formats=(_); end @@ -260,11 +267,11 @@ module ActionView # to ensure that references to the template object can be marshalled as well. This means forgoing # the marshalling of the compiler mutex and instantiating that again on unmarshalling. def marshal_dump # :nodoc: - [ @source, @identifier, @handler, @compiled, @locals, @virtual_path, @format, @variant ] + [ @source, @identifier, @handler, @compiled, @locals, @virtual_path, @updated_at, @format, @variant ] end def marshal_load(array) # :nodoc: - @source, @identifier, @handler, @compiled, @locals, @virtual_path, @format, @variant = *array + @source, @identifier, @handler, @compiled, @locals, @virtual_path, @updated_at, @format, @variant = *array @compile_mutex = Mutex.new end |