aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/lib/action_view/rendering.rb
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2019-02-19 15:52:33 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2019-02-19 15:52:33 -0800
commit1c74752500db94396b9af739489d34ec79fd819b (patch)
tree19c1d9a73a12e3ab19478177dd3179b4b108bd18 /actionview/lib/action_view/rendering.rb
parentf42f1d3155cdb787f90f489d6042ef64be4e6e5f (diff)
downloadrails-1c74752500db94396b9af739489d34ec79fd819b.tar.gz
rails-1c74752500db94396b9af739489d34ec79fd819b.tar.bz2
rails-1c74752500db94396b9af739489d34ec79fd819b.zip
Deprecate LookupContext#rendered_format
We no longer depend on `rendered_format` side effects, so we can remove this method now. 🎉
Diffstat (limited to 'actionview/lib/action_view/rendering.rb')
-rw-r--r--actionview/lib/action_view/rendering.rb15
1 files changed, 9 insertions, 6 deletions
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