I have downgraded from Rails 3.2.11 to Rails 2.3.11 and I am having trouble accessing the tempfile
when my csv file is being uploaded to the server.
It breaks on the code when I call
tmppath = csv.tempfile.to_path.to_s
And here is the trace in my server logs..
Processing YoloController#createByCSV (for 10.1.109.132 at 2013-03-08 10:57:11) [POST]
Parameters: {"csv"=>#<File:/var/folders/5g/xxxxxxxxx/T/RackMultipartxxxxxxx-xxxxxx-81xb7d-0>}
NoMethodError (undefined method `tempfile' for #<Tempfile:0x10c0f8ce8>):
app/controllers/yolos_controller.rb:67:in `createByCSV'
vendor/bundle/ruby/1.8/gems/actionpack-2.3.11/lib/action_controller/base.rb:1333:in `send'
Any ideas would be greatly appreciated.
Judging by the error and the documentation for ruby 1.8. csv
is already a Tempfile
, call path direclty on it: csv.path.to_s
http://ruby-doc.org/stdlib-1.8.7/libdoc/tempfile/rdoc/Tempfile.html#method-i-path