From 1373991dd8feacb0c09a6115a271777810807668 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Thu, 20 Sep 2007 23:34:07 +0000 Subject: Added that render :json will automatically call .to_json unless its being passed a string [DHH] Added Mime::Type.register_alias for dealing with different formats using the same mime type [DHH] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7520 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/lib/action_controller/base.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'actionpack/lib/action_controller/base.rb') diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb index 9a3ab651ac..4630103119 100755 --- a/actionpack/lib/action_controller/base.rb +++ b/actionpack/lib/action_controller/base.rb @@ -826,6 +826,7 @@ module ActionController #:nodoc: render_for_text(xml.respond_to?(:to_xml) ? xml.to_xml : xml, options[:status]) elsif json = options[:json] + json = json.to_json unless json.is_a?(String) json = "#{options[:callback]}(#{json})" unless options[:callback].blank? response.content_type = Mime::JSON render_for_text(json, options[:status]) -- cgit v1.2.3