aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/metal.rb
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2015-10-05 16:50:37 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2015-10-05 16:50:50 -0700
commit69009f4473637a44ade26d954ef5ddea6ff903f2 (patch)
tree4dae45acf6e72e2a6e6e7110c07e8677038fec2c /actionpack/lib/action_controller/metal.rb
parent76698441453821fb175799b99099322688bde6c1 (diff)
downloadrails-69009f4473637a44ade26d954ef5ddea6ff903f2.tar.gz
rails-69009f4473637a44ade26d954ef5ddea6ff903f2.tar.bz2
rails-69009f4473637a44ade26d954ef5ddea6ff903f2.zip
move file sending to the response object
Just a slight refactor that delegates file sending to the response object. This gives us the advantage that if a webserver (in the future) provides a response object that knows how to do accelerated file serving, it can implement this method.
Diffstat (limited to 'actionpack/lib/action_controller/metal.rb')
-rw-r--r--actionpack/lib/action_controller/metal.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/metal.rb b/actionpack/lib/action_controller/metal.rb
index beeaae9d0c..94ec62ec6f 100644
--- a/actionpack/lib/action_controller/metal.rb
+++ b/actionpack/lib/action_controller/metal.rb
@@ -174,7 +174,11 @@ module ActionController
def response_body=(body)
body = [body] unless body.nil? || body.respond_to?(:each)
- response.body = body
+ response.reset_body!
+ body.each { |part|
+ next if part.empty?
+ response.write part
+ }
super
end