aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorOlli Jokinen <olli.jokinen@enemy.fi>2011-07-28 14:42:20 +0300
committerOlli Jokinen <olli.jokinen@enemy.fi>2011-07-28 14:42:20 +0300
commit6b15a45e65addc97bcf30b9d141f97c63df898e8 (patch)
treea8ec50b9465a07f521d4dbfe44b65e92a489bfa7 /actionpack
parent30dae273c85a988a39d9b1dec701c0a48267cd5e (diff)
downloadrails-6b15a45e65addc97bcf30b9d141f97c63df898e8.tar.gz
rails-6b15a45e65addc97bcf30b9d141f97c63df898e8.tar.bz2
rails-6b15a45e65addc97bcf30b9d141f97c63df898e8.zip
Change mimetype to Mime::JS if JSONP is used
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_controller/metal/renderers.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/metal/renderers.rb b/actionpack/lib/action_controller/metal/renderers.rb
index 0ad9dbeda9..1eab57070f 100644
--- a/actionpack/lib/action_controller/metal/renderers.rb
+++ b/actionpack/lib/action_controller/metal/renderers.rb
@@ -93,7 +93,10 @@ module ActionController
add :json do |json, options|
json = json.to_json(options) unless json.kind_of?(String)
- json = "#{options[:callback]}(#{json})" unless options[:callback].blank?
+ unless options[:callback].blank?
+ json = "#{options[:callback]}(#{json})"
+ self.content_type ||= Mime::JS
+ end
self.content_type ||= Mime::JSON
json
end