aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/metal/renderers.rb
diff options
context:
space:
mode:
authorEugene Kenny <elkenny@gmail.com>2019-08-04 00:35:49 +0100
committerEugene Kenny <elkenny@gmail.com>2019-08-04 00:35:49 +0100
commit7cf445d3bdc466f26b4a1929822ccd34daac19a7 (patch)
treec8c695361466cb001623a001e8f247ce35e8ce50 /actionpack/lib/action_controller/metal/renderers.rb
parent6db2c426c0156dd3738673a676261693cfe92a8d (diff)
downloadrails-7cf445d3bdc466f26b4a1929822ccd34daac19a7.tar.gz
rails-7cf445d3bdc466f26b4a1929822ccd34daac19a7.tar.bz2
rails-7cf445d3bdc466f26b4a1929822ccd34daac19a7.zip
Use media_type instead of content_type internally
These calls to `content_type` were triggering the deprecation from c631e8d011a7cf3e7ade4e9e8db56d2b89bd530c in upgraded applications. We can use `media_type` in all of these cases to avoid the deprecation.
Diffstat (limited to 'actionpack/lib/action_controller/metal/renderers.rb')
-rw-r--r--actionpack/lib/action_controller/metal/renderers.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/actionpack/lib/action_controller/metal/renderers.rb b/actionpack/lib/action_controller/metal/renderers.rb
index a251c29d23..660aef4106 100644
--- a/actionpack/lib/action_controller/metal/renderers.rb
+++ b/actionpack/lib/action_controller/metal/renderers.rb
@@ -163,18 +163,18 @@ module ActionController
"/**/#{options[:callback]}(#{json})"
else
- self.content_type ||= Mime[:json]
+ self.content_type = Mime[:json] if media_type.nil?
json
end
end
add :js do |js, options|
- self.content_type ||= Mime[:js]
+ self.content_type = Mime[:js] if media_type.nil?
js.respond_to?(:to_js) ? js.to_js(options) : js
end
add :xml do |xml, options|
- self.content_type ||= Mime[:xml]
+ self.content_type = Mime[:xml] if media_type.nil?
xml.respond_to?(:to_xml) ? xml.to_xml(options) : xml
end
end