Check for to_str rather than String

This commit is contained in:
Jeremy Kemper
2009-04-26 19:08:04 -07:00
parent f5b4a9d02b
commit 5cef0cbad2

View File

@@ -254,7 +254,7 @@ module ActionController
render_for_text(js)
elsif json = options[:json]
json = ActiveSupport::JSON.encode(json) unless json.is_a?(String)
json = ActiveSupport::JSON.encode(json) unless json.respond_to?(:to_str)
json = "#{options[:callback]}(#{json})" unless options[:callback].blank?
response.content_type ||= Mime::JSON
render_for_text(json)