Paperclip S3错误,没有路线匹配[GET]" / assets /:s3_domain_url"

时间:2014-05-10 20:23:56

标签: ruby-on-rails file-upload amazon-s3 paperclip

我试图在我的Rails应用程序中使用Paperclip和S3。但每当我尝试上传文件时,都会收到404错误No route matches [GET] "/assets/:s3_domain_url"

这就是我在config / environments / development.rb中设置Paperclip默认值的方法:

config.paperclip_defaults = {
    :storage => :s3,
    :s3_credentials => {
       :bucket => ENV['S3_BUCKET_NAME'],
       :access_key_id => ENV['AWS_ACCESS_KEY_ID'],
       :secret_access_key => ENV['AWS_SECRET_ACCESS_KEY']
   }
}

这些是模型中的Paperclip设置

has_attached_file :photo, :styles => { :medium => "300x300>", :thumb => "100x100>" }, :default_url => "/assets/profile/iama.png"
validates_attachment :photo, :size => { :in => 0..1000.kilobytes }
validates_attachment_content_type :photo, :content_type => /image/ 
你能帮帮我吗? 感谢

1 个答案:

答案 0 :(得分:0)

问题解决了,我错误地设置了我的环境变量,在S3_BUCKET_NAME,AWS_ACCESS_KEY_ID等周围添加了引号