aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/lib
diff options
context:
space:
mode:
authorAaron Patterson <tenderlove@github.com>2019-02-19 16:43:40 -0800
committerGitHub <noreply@github.com>2019-02-19 16:43:40 -0800
commit982c46a219b4e4bd14e898913e330be2ba68a589 (patch)
treef1b62d7940bfee9e4b93c79eb6fbbd03ad9fc148 /actionview/lib
parentbf835187cee62d96e58a8f9554c762c03b85a4b2 (diff)
parent1c74752500db94396b9af739489d34ec79fd819b (diff)
downloadrails-982c46a219b4e4bd14e898913e330be2ba68a589.tar.gz
rails-982c46a219b4e4bd14e898913e330be2ba68a589.tar.bz2
rails-982c46a219b4e4bd14e898913e330be2ba68a589.zip
Merge pull request #35331 from rails/depreate-rendered-format
Deprecate LookupContext#rendered_format
Diffstat (limited to 'actionview/lib')
-rw-r--r--actionview/lib/action_view/lookup_context.rb3
-rw-r--r--actionview/lib/action_view/rendering.rb15
2 files changed, 11 insertions, 7 deletions
diff --git a/actionview/lib/action_view/lookup_context.rb b/actionview/lib/action_view/lookup_context.rb
index 125ab4dbe3..10cd61bbd6 100644
--- a/actionview/lib/action_view/lookup_context.rb
+++ b/actionview/lib/action_view/lookup_context.rb
@@ -16,6 +16,8 @@ module ActionView
# only once during the request, it speeds up all cache accesses.
class LookupContext #:nodoc:
attr_accessor :prefixes, :rendered_format
+ deprecate :rendered_format
+ deprecate :rendered_format=
mattr_accessor :fallbacks, default: FallbackFileSystemResolver.instances
@@ -250,7 +252,6 @@ module ActionView
@digest_cache = nil
@cache = true
@prefixes = prefixes
- @rendered_format = nil
@details = initialize_details({}, details)
@view_paths = build_view_paths(view_paths)
diff --git a/actionview/lib/action_view/rendering.rb b/actionview/lib/action_view/rendering.rb
index 699ccb0ca8..ac861c44d4 100644
--- a/actionview/lib/action_view/rendering.rb
+++ b/actionview/lib/action_view/rendering.rb
@@ -26,6 +26,13 @@ module ActionView
extend ActiveSupport::Concern
include ActionView::ViewPaths
+ attr_reader :rendered_format
+
+ def initialize
+ @rendered_format = nil
+ super
+ end
+
# Overwrite process to setup I18n proxy.
def process(*) #:nodoc:
old_config, I18n.config = I18n.config, I18nProxy.new(I18n.config, lookup_context)
@@ -96,10 +103,6 @@ module ActionView
_render_template(options)
end
- def rendered_format
- Template::Types[lookup_context.rendered_format]
- end
-
private
# Find and render a template based on the options given.
@@ -115,7 +118,8 @@ module ActionView
renderer.render_to_object(context, options)
end
- lookup_context.rendered_format = rendered_template.format || lookup_context.formats.first
+ rendered_format = rendered_template.format || lookup_context.formats.first
+ @rendered_format = Template::Types[rendered_format]
rendered_template.body
end
@@ -124,7 +128,6 @@ module ActionView
def _process_format(format)
super
lookup_context.formats = [format.to_sym]
- lookup_context.rendered_format = lookup_context.formats.first
end
# Normalize args by converting render "foo" to render :action => "foo" and