">= 0.6.2", :lib => "aws/s3"config.gem 'right_aws', :versi" />

未初始化的常量AWS :: S3 :: NoSuchBucket常量、初始化、AWS、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', :versi...

我用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',
  ...
阅读全文

相关推荐

最新文章