diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2007-09-20 23:34:07 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2007-09-20 23:34:07 +0000 |
commit | 1373991dd8feacb0c09a6115a271777810807668 (patch) | |
tree | 59aa13a830091d5c440d37928f69ff49d9f4ff1a /actionpack/lib/action_controller/base.rb | |
parent | e86d1cd621ca62af6f71b04032b1e07a66c06bb6 (diff) | |
download | rails-1373991dd8feacb0c09a6115a271777810807668.tar.gz rails-1373991dd8feacb0c09a6115a271777810807668.tar.bz2 rails-1373991dd8feacb0c09a6115a271777810807668.zip |
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
Diffstat (limited to 'actionpack/lib/action_controller/base.rb')
-rwxr-xr-x | actionpack/lib/action_controller/base.rb | 1 |
1 files changed, 1 insertions, 0 deletions
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]) |