部署时PaperClip + S3 AWS + Rails 3 + Heroku错误

时间:2013-02-18 14:08:53

标签: ruby-on-rails-3 heroku amazon-web-services amazon-s3 paperclip

我正在尝试在s3上托管我的图片,但是当我将我的应用部署到heroku时,它返回了一个错误:

Heroku日志:

Completed 500 Internal Server Error in 14ms
2013-02-18T13:58:01+00:00 app[web.1]: 
2013-02-18T13:58:01+00:00 app[web.1]:     12:     <%= f.input :needshussler, as: :boolean, label: "Hussler" %>
2013-02-18T13:58:01+00:00 app[web.1]: ActionView::Template::Error (no such file to load -- aws-sdk (You may need to install the aws-sdk gem)):

我在亚马逊创建了一个名为startupcogs-pro的存储桶

我的config / s3.yml文件包含:

development:


 bucket: startupcogs-dev
  access_key_id: ***
  secret_access_key: ***
production:
  bucket: startupcogs-pro
  access_key_id: ***
  secret_access_key: ***

我的初始值设定项/ s3.rb包含:

if Rails.env == "production"
  # set credentials from ENV hash
  S3_CREDENTIALS = { :access_key_id => ENV['S3_KEY'], :secret_access_key => ENV['S3_SECRET'], :bucket => ENV['S3_BUCKET']}
else
  # get credentials from YML file
  S3_CREDENTIALS = Rails.root.join("config/s3.yml")
end

我的模特有:

has_attached_file :image, :storage => :s3, :s3_credentials => S3_CREDENTIALS, styles: { large: "800x600>"}

我以这种方式设置了我的heroku键:

heroku config:add S3_KEY=*** S3_SECRET=*** S3_BUCKET=startupcogs-dev

任何帮助都会很棒!苦苦挣扎了一段时间......

三江源

1 个答案:

答案 0 :(得分:1)

显然我只有aws-s3宝石而不是aws-sdk宝石!