aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/http
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-10-04 16:56:45 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2010-10-04 16:56:45 -0700
commit2a3022db7f2ddc0fc0e678ea757f97902c5f5c01 (patch)
tree115d29e58d06610d6506afb1fda37c7ecd1f981a /actionpack/lib/action_dispatch/http
parentf9734f2b0f5326c399d1c1cccba8b6d8e7d9bdd4 (diff)
downloadrails-2a3022db7f2ddc0fc0e678ea757f97902c5f5c01.tar.gz
rails-2a3022db7f2ddc0fc0e678ea757f97902c5f5c01.tar.bz2
rails-2a3022db7f2ddc0fc0e678ea757f97902c5f5c01.zip
delegate to the @tempfile instance variable
Diffstat (limited to 'actionpack/lib/action_dispatch/http')
-rw-r--r--actionpack/lib/action_dispatch/http/upload.rb18
1 files changed, 5 insertions, 13 deletions
diff --git a/actionpack/lib/action_dispatch/http/upload.rb b/actionpack/lib/action_dispatch/http/upload.rb
index 49465d820e..bfbe7c5305 100644
--- a/actionpack/lib/action_dispatch/http/upload.rb
+++ b/actionpack/lib/action_dispatch/http/upload.rb
@@ -2,27 +2,19 @@ require 'active_support/core_ext/object/blank'
module ActionDispatch
module Http
- class UploadedFile < Tempfile
+ class UploadedFile
attr_accessor :original_filename, :content_type, :tempfile, :headers
def initialize(hash)
@original_filename = hash[:filename]
@content_type = hash[:type]
@headers = hash[:head]
-
- # To the untrained eye, this may appear as insanity. Given the alternatives,
- # such as busting the method cache on every request or breaking backwards
- # compatibility with is_a?(Tempfile), this solution is the best available
- # option.
- #
- # TODO: Deprecate is_a?(Tempfile) and define a real API for this parameter
- tempfile = hash[:tempfile]
- tempfile.instance_variables.each do |ivar|
- instance_variable_set(ivar, tempfile.instance_variable_get(ivar))
- end
+ @tempfile = hash[:tempfile]
end
- alias local_path path
+ def method_missing(name, *args, &block)
+ @tempfile.send(name, *args, &block)
+ end
end
module Upload