Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 8492

Show
Ignore:
Timestamp:
12/27/07 11:17:53 (2 years ago)
Author:
bitsweat
Message:

Ruby 1.9 compat: file uploads. References #1689 [Frederick Cheung]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionpack/lib/action_controller/request.rb

    r8425 r8492  
    474474              value.map { |v| get_typed_value(v) } 
    475475            else 
    476               if value.is_a?(UploadedFile) 
     476              if value.respond_to? :original_filename 
    477477                # Uploaded file 
    478478                if value.original_filename 
     
    499499          params = Hash.new([]) 
    500500          boundary = "--" + boundary 
    501           quoted_boundary = Regexp.quote(boundary, "n"
     501          quoted_boundary = Regexp.quote(boundary
    502502          buf = "" 
    503503          bufsize = 10 * 1024 
  • trunk/actionpack/test/controller/dispatcher_test.rb

    r7944 r8492  
    1717 
    1818  def teardown 
    19     ENV['REQUEST_METHOD'] = nil 
     19    ENV.delete 'REQUEST_METHOD' 
    2020  end 
    2121 
  • trunk/actionpack/test/controller/request_test.rb

    r8433 r8492  
    732732 
    733733    file = params['file'] 
    734     assert_kind_of Tempfile, file 
     734    if RUBY_VERSION > '1.9' 
     735      assert_kind_of File, file 
     736    else 
     737      assert_kind_of Tempfile, file 
     738    end 
    735739    assert_equal 'file.txt', file.original_filename 
    736740    assert_equal "text/plain", file.content_type