未初始化的常量AWS :: S3 :: NoSuchBucket [英] uninitialized constant AWS::S3::NoSuchBucket

查看:886
本文介绍了未初始化的常量AWS :: S3 :: NoSuchBucket的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用Rails 3有以下code ...

I am using Rails 3 with the following code...

config.gem "aws-s3", :version => ">= 0.6.2", :lib => "aws/s3"
config.gem 'right_aws', :version => '2.0.0'

model.rb

model.rb

has_attached_file :video, 
                      :storage => :s3,
                      :s3_credentials => "#{::Rails.root.to_s}/config/s3.yml",
                      :path => ":attachment/:id/:style/:basename.:extension"

                    # Paperclip Validations
                    validates_attachment_presence :video
                    validates_attachment_content_type :video, :content_type => ['application/x-shockwave-flash', 'application/x-shockwave-flash', 'application/flv', 'video/x-flv']

s3.yml

s3.yml

development:
  bucket_name: tekbookvideo
  access_key_id: xxxx
  secret_access_key: yyyy
production:
  bucket_name: tekbookvideo
  access_key_id: xxxx
  secret_access_key: yyyy

和我得到的未初始化不断AWS :: S3 :: NoSuchBucket错误...

And am getting the uninitialized constant AWS::S3::NoSuchBucket error...

我不知道该怎么办了......

I do not know what to do anymore...

推荐答案

我遇到了这个问题,并经历了非常大的头疼了吧。我最终的解决办法是登录亚马逊并创建一个新桶。然后,我在模型中设置桶的名字像这样的参数......

I encountered this problem and experienced a very large headache over it. My eventual solution was to log in to amazon and create a new bucket. Then I set the name of the bucket in the model as a parameter like so...

has_attached_file :video,
  :storage => :s3,
  :bucket => 'bucketname',
  ...

这篇关于未初始化的常量AWS :: S3 :: NoSuchBucket的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆