aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2007-12-09 22:11:37 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2007-12-09 22:11:37 +0000
commitbafd698acb160fd241efe6f027b83676b9e80d1f (patch)
treefa23a0ef6f6e774b7ce74000b1742c88bd4fc953 /actionpack/lib/action_controller
parent3fab196da37ef76cfce040717d4176945212aea8 (diff)
downloadrails-bafd698acb160fd241efe6f027b83676b9e80d1f.tar.gz
rails-bafd698acb160fd241efe6f027b83676b9e80d1f.tar.bz2
rails-bafd698acb160fd241efe6f027b83676b9e80d1f.zip
render :xml and :json preserve custom content types. Closes #10388.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8342 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_controller')
-rwxr-xr-xactionpack/lib/action_controller/base.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb
index b5c4780f52..f1d416d664 100755
--- a/actionpack/lib/action_controller/base.rb
+++ b/actionpack/lib/action_controller/base.rb
@@ -873,13 +873,13 @@ module ActionController #:nodoc:
end
elsif xml = options[:xml]
- response.content_type = Mime::XML
+ response.content_type ||= Mime::XML
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
+ response.content_type ||= Mime::JSON
render_for_text(json, options[:status])
elsif partial = options[:partial]