对于一个新的应用程序,我想使用回形针将文件存储到S3。我已经为另一个应用程序安装了aws-s3 gem。这似乎引起了一些问题,因为回形针应使用right_aws,但正尝试使用aws-s3 gem。但是我不想从系统中删除aws-s3 gem。有办法解决这种冲突吗?也许通过强制回形针使用right_aws?还是通过更改配置?
我的设置
# enviroment.rb
config.gem 'right_aws'
# my model with the attachment
has_attached_file :thumbnail,
:styles => { :thumb => "160x120>" },
:storage => :s3,
:s3_credentials => "#{RAILS_ROOT}/config/amazons3.yml",
:path => ":provider/:attachment/:id_:style.:extension"
# config/amazons3.yml
development:
bucket: bucketname
access_key_id: secret
secret_access_key: secret
test:
bucket: bucketname
access_key_id: secret
secret_access_key: secret
production:
bucket: bucketname
access_key_id: secret
secret_access_key: secret
# The Error in the console
ArgumentError: wrong number of arguments (5 for 4)
from /Library/Ruby/Gems/1.8/gems/right_http_connection-1.2.4/lib/net_fix.rb:85:in `send_request_with_body_stream'
from /Library/Ruby/Gems/1.8/gems/right_http_connection-1.2.4/lib/net_fix.rb:85:in `exec'
from /Library/Ruby/Gems/1.8/gems/right_http_connection-1.2.4/lib/net_fix.rb:144:in `request'
from /Library/Ruby/Gems/1.8/gems/aws-s3-0.6.2/lib/aws/s3/connection.rb:45:in `request'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/net/http.rb:543:in `start'
from /Library/Ruby/Gems/1.8/gems/aws-s3-0.6.2/lib/aws/s3/connection.rb:52:in `request'
from /Library/Ruby/Gems/1.8/gems/aws-s3-0.6.2/lib/aws/s3/base.rb:69:in `request'
from /Library/Ruby/Gems/1.8/gems/aws-s3-0.6.2/lib/aws/s3/base.rb:88:in `put'
from /Library/Ruby/Gems/1.8/gems/aws-s3-0.6.2/lib/aws/s3/object.rb:241:in `store'
...
谢谢!
最佳答案
哇,那太快了。我通过仅使用aws-s3 gem解决了该问题,因此将我的enviroment.rb更改为:
#config.gem 'right_aws'
config.gem "aws-s3", :version => ">= 0.6.2", :lib => "aws/s3"
希望能帮助到别人!
关于ruby-on-rails - aws-s3 gem 和right_aws gem 之间的Rails回形针冲突。怎么解决?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/1550708/