Exception when using s3 from a rake task
yetanothernguyen opened this issue · 5 comments
Hi,
I use the library in a rails rake task that upload file to S3. I got the following exception:
wrong number of arguments (2 for 0)
/usr/local/rvm/gems/ruby-1.8.7-p302/gems/s3-0.3.7/lib/s3/objects_extension.rb:6:in initialize' /usr/local/rvm/gems/ruby-1.8.7-p302/gems/s3-0.3.7/lib/s3/objects_extension.rb:6:in
new'
/usr/local/rvm/gems/ruby-1.8.7-p302/gems/s3-0.3.7/lib/s3/objects_extension.rb:6:in send' /usr/local/rvm/gems/ruby-1.8.7-p302/gems/s3-0.3.7/lib/s3/objects_extension.rb:6:in
build'
The task does require rails environment. The same code executed just fine by script/runner however.
Thanks.
Can't reproduce the error.
It works when I changes the following line in objects_extension.rb
Object.send(:new, proxy_owner, :key => key)
To:
S3::Object.send(:new, proxy_owner, :key => key)
For some reason 'new' was sent to Ruby's Object class instead of S3::Object. Again, this only happens when I call the code from a rake task.
You call private method "new", it's not a part of public API. Please read the documentation first.
edit: sorry, I thought that it's the task code. I'll try to reproduce the error again.
I'm not sure if it's a problem of s3 or rake. It'd be nice if someone else confirms this bug.
Hi, we have this error too. Did a server change and peng!
Maybe that is something with the loading-order of s3 and other plugins?