diff options
author | Xavier Noria <fxn@hashref.com> | 2011-04-23 01:16:21 +0200 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2011-04-23 01:16:21 +0200 |
commit | 384dbfd1408721ded071a587b0dc9ee40203607e (patch) | |
tree | 770854b984691dea8187ca0a998a28e93a008093 /actionpack/lib/action_dispatch/http/response.rb | |
parent | 900470cf3cd346ad1b17cf6902f3f98e6dae7709 (diff) | |
parent | af1b48926f49226c934995c322ee017239158cf3 (diff) | |
download | rails-384dbfd1408721ded071a587b0dc9ee40203607e.tar.gz rails-384dbfd1408721ded071a587b0dc9ee40203607e.tar.bz2 rails-384dbfd1408721ded071a587b0dc9ee40203607e.zip |
Merge branch 'master' of git://github.com/rails/rails
Diffstat (limited to 'actionpack/lib/action_dispatch/http/response.rb')
-rw-r--r-- | actionpack/lib/action_dispatch/http/response.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/actionpack/lib/action_dispatch/http/response.rb b/actionpack/lib/action_dispatch/http/response.rb index 78ecf177be..1f4f3ac0da 100644 --- a/actionpack/lib/action_dispatch/http/response.rb +++ b/actionpack/lib/action_dispatch/http/response.rb @@ -118,7 +118,15 @@ module ActionDispatch # :nodoc: def body=(body) @blank = true if body == EMPTY - @body = body.respond_to?(:each) ? body : [body] + + # Explicitly check for strings. This is *wrong* theoretically + # but if we don't check this, the performance on string bodies + # is bad on Ruby 1.8 (because strings responds to each then). + @body = if body.respond_to?(:to_str) || !body.respond_to?(:each) + [body] + else + body + end end def body_parts |