[英]Paperclip NameError (uninitialized constant AWS::S3::Errors) in Rails 4 on heroku
When I upload an image using paperclip and s3 storage. 当我使用回形针和s3存储上载图像时。 The app works fine locally, I've made the required changes to use s3 for
heroku
, but on heroku the issue remains continues: 该应用程序在本地运行良好,我已经进行了必要的更改以将s3用于
heroku
,但是在heroku上,问题仍然存在:
Gemfile 宝石文件
ruby '2.0.0'
gem 'rails', '4.0.3'
gem 'aws-s3'
gem 'aws-sdk', '< 2.0'
gem 'paperclip', "~> 3.5.3"
store.rb store.rb
class Store < ActiveRecord::Base
has_attached_file :logo,
styles: {
thumb: ["40x40#", :png],
small: ["400x400>", :png]},
default_url: "#{Rails.root}/app/assets/images/missing.jpg",
storage: :s3,
s3_credentials: "#{Rails.root}/config/s3.yml",
path: "/store_logos/:style/:id/:filename"
end
config/s3.yml config / s3.yml
development:
bucket: app-dev
access_key_id: ***********
secret_access_key: ***************
production:
bucket: app-pro
access_key_id: ***********
secret_access_key: ***************
I tried this link but no luck. 我尝试了此链接,但没有运气。
Any help appreciated 任何帮助表示赞赏
Finally, I got the solution to the issue. 最后,我找到了解决问题的方法。 Updated the
Gemfile
and models/store.rb
. 更新了
Gemfile
和models/store.rb
。
Reference document here 参考文件在这里
Gemfile 宝石文件
ruby '2.0.0'
gem 'rails', '4.0.3'
gem 'aws-s3'
gem 'aws-sdk-v1'
gem 'aws-sdk', '~> 2'
models/store.rb 型号/store.rb
class Store < ActiveRecord::Base
require 'aws-sdk-v1'
require 'aws-sdk'
has_attached_file :logo,
styles: {
thumb: ["40x40#", :png],
small: ["400x400>", :png]},
default_url: "#{Rails.root}/app/assets/images/missing.jpg",
storage: :s3,
s3_credentials: "#{Rails.root}/config/s3.yml",
path: "/store_logos/:style/:id/:filename"
end
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.