diff options
author | José Valim <jose.valim@gmail.com> | 2012-04-29 01:13:39 -0700 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2012-04-29 01:13:39 -0700 |
commit | d4dd1af341dcc1908b594567991845324df0ee56 (patch) | |
tree | eca4b08b85a15bf6b84f6a4de0093f6c62fd5a70 /actionpack/lib/action_controller | |
parent | e6ab0d56cf5d376f4b351282c606ecc74e6fad9a (diff) | |
parent | b4e1903d23a760028d58bc3bb20a1d491bfd4a4b (diff) | |
download | rails-d4dd1af341dcc1908b594567991845324df0ee56.tar.gz rails-d4dd1af341dcc1908b594567991845324df0ee56.tar.bz2 rails-d4dd1af341dcc1908b594567991845324df0ee56.zip |
Merge pull request #2321 from omjokine/master
JSONP should use mimetype application/javascript
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r-- | actionpack/lib/action_controller/metal/renderers.rb | 5 |
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 6e9ce450ac..d69816915b 100644 --- a/actionpack/lib/action_controller/metal/renderers.rb +++ b/actionpack/lib/action_controller/metal/renderers.rb @@ -91,7 +91,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 |