将回形针图像上传到s3存储桶

时间:2013-09-05 10:57:01

标签: ruby ruby-on-rails-3 amazon-s3 paperclip

不太清楚这里有什么,但是当我尝试将图像上传到我的s3存储桶时,我收到此错误

 NameError in PostsController#create

 uninitialized constant AWS::Core::ClientLogging

 Rails.root: /home/richardlewis/Rails/myblog
 Application Trace | Framework Trace | Full Trace

 app/controllers/posts_controller.rb:41:in `create'

我目前正在我的开发环境中测试它。这是我目前的设置

的Gemfile

#Paperclip and aws
gem "paperclip", "~> 3.0"
gem 'aws-sdk'
gem 'aws-s3'

图像模型

class Image < ActiveRecord::Base
belongs_to :imageable, polymorphic: true

attr_accessible :photo
has_attached_file :photo, :styles => { :small_blog => "250x250#", :large_blog => "680x224#", :thumb => "95x95#" },
 :storage => :s3,
 :url  => ":s3_domain_url",
 :s3_protocol => 'http',
 :path => "/images/:id/:style.:extension",
 :s3_credentials => {
 :bucket => ENV['AWS_BUCKET'],
 :access_key_id => ENV['AWS_ACCESS_KEY_ID'],
 :secret_access_key => ENV['AWS_SECRET_ACCESS_KEY']
}
end

我的ENV变量存储在env.rb文件中并加载到初始化程序

以前有人遇到过这个吗?

1 个答案:

答案 0 :(得分:1)

升级到最新的回形针3.5.1,将解决此问题。