对于新的应用程序,我想使用paperclip将文件存储到S3.我已经为另一个应用程序安装了aws-s3 gem.这似乎会导致一些问题,因为Paperclip应该使用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 …
Run Code Online (Sandbox Code Playgroud) 我在使用回形针和 AWS gem 的 LocationsController#create 中收到以下错误AWS::Errors::MissingCredentialsError
有关异常的更多详细信息:
Missing Credentials. Unable to find AWS credentials.
You can configure your AWS credentials a few different ways:
* Call AWS.config with :access_key_id and :secret_access_key
* Export AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY to ENV *
Run Code Online (Sandbox Code Playgroud)
我目前正在我的机器上的开发环境中运行此代码这是development.rb
Gmaps::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# …
Run Code Online (Sandbox Code Playgroud)