S3 secure storage: Wrong number of arguments (2 for 1) #679

Closed
dongennl opened this Issue Apr 2, 2012 · 4 comments

Comments

Projects
None yet
3 participants

dongennl commented Apr 2, 2012

Hi, Rails 3.2.1, carrierwave 0.6.0, fog 0.9.0
Everything works fine with local storage and S3 with "config.fog_public = true", as soon as I set "config.fog_public = false" I get this on the view display:

ArgumentError: wrong number of arguments (2 for 1)

This is in my view:
<%= image_tag current_user.profile.picture_url %> (User has_one Profile, field is picture)

Uploader:
class PictureUploader < CarrierWave::Uploader::Base
include CarrierWave::RMagick
storage :fog
def store_dir
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end
process :resize_to_limit => [200, 200]
def extension_white_list
%w(jpg jpeg gif png)
end
end

initializer:
CarrierWave.configure do |config|
config.fog_credentials = {
:provider => 'AWS', # required
:aws_access_key_id => 'xxx', # required
:aws_secret_access_key => 'yyy', # required
:region => 'eu-west-1' # optional, defaults to 'us-east-1'
}
config.fog_directory = 'attachprod' # required
config.fog_public = false # optional, defaults to true
end

Now, I have been able to fix this by changing line 126 in /fog-0.9.0/lib/fog/storage/models/aws/file.rb to:
"def url(expires, x)" instead of "def url(expires)"
but that seems weird and not sure if that will break something else; it appears to work fine now.

Here's my full stack of the error:
ArgumentError: wrong number of arguments (2 for 1)
from /Users/boudewijnvandongen/.rvm/gems/ruby-1.9.2-p290/gems/fog-0.9.0/lib/fog/storage/models/aws/file.rb:126:in url' from /Users/boudewijnvandongen/.rvm/gems/ruby-1.9.2-p290/gems/carrierwave-0.6.0/lib/carrierwave/storage/fog.rb:148:inauthenticated_url'
from /Users/boudewijnvandongen/.rvm/gems/ruby-1.9.2-p290/gems/carrierwave-0.6.0/lib/carrierwave/storage/fog.rb:307:in url' from /Users/boudewijnvandongen/.rvm/gems/ruby-1.9.2-p290/gems/carrierwave-0.6.0/lib/carrierwave/uploader/url.rb:19:inurl'
from /Users/boudewijnvandongen/.rvm/gems/ruby-1.9.2-p290/gems/carrierwave-0.6.0/lib/carrierwave/uploader/versions.rb:159:in url' from /Users/boudewijnvandongen/.rvm/gems/ruby-1.9.2-p290/gems/carrierwave-0.6.0/lib/carrierwave/uploader/default_url.rb:8:inurl'
from /Users/boudewijnvandongen/.rvm/gems/ruby-1.9.2-p290/gems/carrierwave-0.6.0/lib/carrierwave/uploader/url.rb:27:in to_s' from /Users/boudewijnvandongen/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/commands/console.rb:47:instart'
from /Users/boudewijnvandongen/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/commands/console.rb:8:in start' from /Users/boudewijnvandongen/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/commands.rb:41:in<top (required)>'
from script/rails:6:in require' from script/rails:6:in

'

This a bug in Fog or am I doing something wrong???
many thanks

Owner

bensie commented Apr 2, 2012

You'll need to update Fog to 1.3.1.

@bensie bensie closed this Apr 2, 2012

Owner

bensie commented Apr 2, 2012

I've added notes to the Readme that specify the Fog version requirement df4b01a

dongennl commented Apr 2, 2012

Thanks, upgrading Fog solved the issue.

On 2 April 2012 16:45, James Miller <
reply@reply.github.com

wrote:

I've added notes to the Readme that specify the Fog version requirement
df4b01a


Reply to this email directly or view it on GitHub:
jnicklas#679 (comment)

yeah. i ran into this problem as well.
initially thought it may be my configuration problem.
But after upgrade to 1.3.1, the problem solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment