diff options
author | Neeraj Singh <neerajdotname@gmail.com> | 2010-11-15 17:52:39 -0500 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-11-24 22:08:36 +0100 |
commit | fa2a5ae0339c90d023a7559e681a588219dc3903 (patch) | |
tree | 0ae3454ed851940c59d239f08f6223d3fffaac59 /actionpack/lib/action_controller | |
parent | 66212f69acc3d51af10ff76a18ff4c0bfa305ea5 (diff) | |
download | rails-fa2a5ae0339c90d023a7559e681a588219dc3903.tar.gz rails-fa2a5ae0339c90d023a7559e681a588219dc3903.tar.bz2 rails-fa2a5ae0339c90d023a7559e681a588219dc3903.zip |
If a user wants json output then try best to render json output. In such cases prefer kind_of(String) over respond_to?(to_str)
[#5841 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r-- | actionpack/lib/action_controller/metal/renderers.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/metal/renderers.rb b/actionpack/lib/action_controller/metal/renderers.rb index 67cf08445d..d6f6ab1855 100644 --- a/actionpack/lib/action_controller/metal/renderers.rb +++ b/actionpack/lib/action_controller/metal/renderers.rb @@ -55,7 +55,7 @@ module ActionController end add :json do |json, options| - json = json.to_json(options) unless json.respond_to?(:to_str) + json = json.to_json(options) unless json.kind_of?(String) json = "#{options[:callback]}(#{json})" unless options[:callback].blank? self.content_type ||= Mime::JSON self.response_body = json |