aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch
diff options
context:
space:
mode:
authorTim Linquist <tim.linquist@gmail.com>2014-04-15 11:05:08 -0700
committerTim Linquist <tim.linquist@gmail.com>2014-04-15 11:05:08 -0700
commite601728dceb779b6b2aae800c66eb8b3f20f9aaa (patch)
tree847f6c16e524ca990aee6113c3d67b9a3cdd8dd8 /actionpack/lib/action_dispatch
parent43f525031ad3f83a04f84e79bbe1de340bf937aa (diff)
downloadrails-e601728dceb779b6b2aae800c66eb8b3f20f9aaa.tar.gz
rails-e601728dceb779b6b2aae800c66eb8b3f20f9aaa.tar.bz2
rails-e601728dceb779b6b2aae800c66eb8b3f20f9aaa.zip
Provide interface for accessing underlying IO object
In some cases users may need to work with/manipulate more of the Tempfile api than provided by Upload. Allow users to get at the underlying io via the common to_io method of IO/IO-like objects
Diffstat (limited to 'actionpack/lib/action_dispatch')
-rw-r--r--actionpack/lib/action_dispatch/http/upload.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/actionpack/lib/action_dispatch/http/upload.rb b/actionpack/lib/action_dispatch/http/upload.rb
index a8d2dc3950..afbfa58bce 100644
--- a/actionpack/lib/action_dispatch/http/upload.rb
+++ b/actionpack/lib/action_dispatch/http/upload.rb
@@ -31,6 +31,11 @@ module ActionDispatch
@headers = hash[:head]
end
+ # Shortcut for working directly with +tempfile+
+ def to_io
+ @tempfile
+ end
+
# Shortcut for +tempfile.read+.
def read(length=nil, buffer=nil)
@tempfile.read(length, buffer)