From e601728dceb779b6b2aae800c66eb8b3f20f9aaa Mon Sep 17 00:00:00 2001 From: Tim Linquist Date: Tue, 15 Apr 2014 11:05:08 -0700 Subject: 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 --- actionpack/lib/action_dispatch/http/upload.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'actionpack/lib/action_dispatch') 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) -- cgit v1.2.3