Carrierwave 和 s3 与 heroku 错误未定义方法 `fog_credentials='
我正在尝试使用 heroku 设置 Carrierwave 和 s3。我完全遵循 Carrierwave 文档: https://github.com/jnicklas/rierwave
我已经在AWS中设置一个名为testbucket的存储桶,然后我安装了fog并在里面创建了一个新的初始化程序:
CarrierWave.configure do |config|
config.fog_credentials = {
:provider => 'AWS', # required
:aws_access_key_id => 'my_key_inside_here', # required
:aws_secret_access_key => 'my_secret_access_key_here', # required
:region => 'eu-west-1' # optional, defaults to 'us-east-1'
}
config.fog_directory = 'testbucket' # required
end
然后在我的image_uploader.rb中设置了
storage :fog
还有我还缺少的东西吗???感谢您的任何帮助。
I'm trying to setup carrierwave and s3 with heroku. I'm following the carrierwave docs exactly: https://github.com/jnicklas/carrierwave
I've setup a bucket named testbucket in AWS, then I installed fog and created a new initializer with this inside :
CarrierWave.configure do |config|
config.fog_credentials = {
:provider => 'AWS', # required
:aws_access_key_id => 'my_key_inside_here', # required
:aws_secret_access_key => 'my_secret_access_key_here', # required
:region => 'eu-west-1' # optional, defaults to 'us-east-1'
}
config.fog_directory = 'testbucket' # required
end
Then inside my image_uploader.rb I set
storage :fog
Is there something else I am missing??? Thanks for any help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您使用的是 Carrier-wave 0.5.2,则必须查看 gem 中的文档。它们与您在 github 上看到的不同。具体来说,在 gem 中查看此文件:lib/carrierwave/storage/s3.rb
还将 store 设置为 :s3... 而不是 :fog。
您将看到此部分:
If you're using carrier-wave 0.5.2, you have to look in the docs within the gem. They are different than what you see on github. Specifically, check out this file in the gem: lib/carrierwave/storage/s3.rb
Also set store to :s3...not :fog.
You'll see this section: