aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller
diff options
context:
space:
mode:
authorRyan Bates <ryan@railscasts.com>2008-08-19 19:09:04 -0500
committerJoshua Peek <josh@joshpeek.com>2008-08-19 19:09:04 -0500
commita8ece12fe2ac7838407954453e0d31af6186a5db (patch)
tree5a6cb0a957bebc1da95c1918563db10447cacd26 /actionpack/lib/action_controller
parent71c4ff07ab4313c1f4781d59ad2f4528f5875665 (diff)
downloadrails-a8ece12fe2ac7838407954453e0d31af6186a5db.tar.gz
rails-a8ece12fe2ac7838407954453e0d31af6186a5db.tar.bz2
rails-a8ece12fe2ac7838407954453e0d31af6186a5db.zip
Return nil instead of a space when passing an empty collection or nil to 'render :partial' [#791 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r--actionpack/lib/action_controller/base.rb9
1 files changed, 6 insertions, 3 deletions
diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb
index 0fdbcbd26f..09414e7702 100644
--- a/actionpack/lib/action_controller/base.rb
+++ b/actionpack/lib/action_controller/base.rb
@@ -939,8 +939,7 @@ module ActionController #:nodoc:
render_for_text(generator.to_s, options[:status])
elsif options[:nothing]
- # Safari doesn't pass the headers of the return if the response is zero length
- render_for_text(" ", options[:status])
+ render_for_text(nil, options[:status])
else
render_for_file(default_template_name, options[:status], true)
@@ -1154,7 +1153,11 @@ module ActionController #:nodoc:
response.body ||= ''
response.body << text.to_s
else
- response.body = text.is_a?(Proc) ? text : text.to_s
+ response.body = case text
+ when Proc then text
+ when nil then " " # Safari doesn't pass the headers of the return if the response is zero length
+ else text.to_s
+ end
end
end