Ruby on rails AWS::S3::CurrentBucketNotSpecified
AWS::S3::CurrentBucketNotSpecified 无法从当前连接的地址(`s3.amazonaws.com')推断出任何存储桶名称 以前有人见过这个吗?带有Rails 3+回形针+s3的应用程序运行得很好,然后我升级到RVM,这就发生了 /config/S3.ymlRuby on rails AWS::S3::CurrentBucketNotSpecified,ruby-on-rails,ruby-on-rails-3,amazon-s3,paperclip,Ruby On Rails,Ruby On Rails 3,Amazon S3,Paperclip,AWS::S3::CurrentBucketNotSpecified 无法从当前连接的地址(`s3.amazonaws.com')推断出任何存储桶名称 以前有人见过这个吗?带有Rails 3+回形针+s3的应用程序运行得很好,然后我升级到RVM,这就发生了 /config/S3.yml common: &common access_key_id: 123123123123123123 secret_access_key: asdasdasdasdasdasdasdasd
common: &common
access_key_id: 123123123123123123
secret_access_key: asdasdasdasdasdasdasdasd
development:
<<: *common
bucket: xxxx_dev
test:
<<: *common
bucket: xxxx_test
production:
<<: *common
bucket: xxxx_prod
关于这个问题或如何调试有什么建议或想法吗?谢谢
更新,我允许上传带有url的照片,如下所示:
before_validation :download_remote_image, :if => :photo_url_provided?
# Used to handle paperclip via an image URL
def photo_url_provided?
!self.photo_url.blank?
end
# Used to handle paperclip via an image URL
def download_remote_image
self.photo = do_download_remote_image
end
# Used to handle paperclip via an image URL
def do_download_remote_image
io = open(URI.parse(photo_url))
def io.original_filename; base_uri.path.split('/').last; end
io.original_filename.blank? ? nil : io
rescue # catch url errors with validations instead of exceptions (Errno::ENOENT, OpenURI::HTTPError, etc...)
end
加
你的回形针属性
我建议在不同的环境中使用nifty:configuration:configuration:bucket=>'bucket\u name'在我的has\u attached\u文件配置散列中。可能重复:可能重复感谢,但我刚刚添加了:s3\u bucket=>“xxxx\u dev“手动操作,但不起作用。同样的错误。可能与photo_url有关,问题已用代码更新。当我尝试使用url保存图像时,我仍然会在控制台中看到这个问题:ruby-1.9.2-p180:003>@user.save AWS::S3::CurrentBucketNotSpecified:无法从当前连接的地址推断出存储桶名称(
S3.amazonaws.com'))从/Users/bhellman/.rvm/gems/ruby-1.9.2-p180/gems/aws-s3-0.6.2/lib/aws/s3/base.rb:107:in
current_bucket'from/Users/bhellman/.rvm/gems/ruby-1.9.2-p180/gems/aws-s3-0.6.2/lib/aws/s3/base.rb:179:bucket'u name'看看我上面的答案,可能是:bucket不是:s3_bucket,我必须承认我换成了carrierwave
before_validation :download_remote_image, :if => :photo_url_provided?
# Used to handle paperclip via an image URL
def photo_url_provided?
!self.photo_url.blank?
end
# Used to handle paperclip via an image URL
def download_remote_image
self.photo = do_download_remote_image
end
# Used to handle paperclip via an image URL
def do_download_remote_image
io = open(URI.parse(photo_url))
def io.original_filename; base_uri.path.split('/').last; end
io.original_filename.blank? ? nil : io
rescue # catch url errors with validations instead of exceptions (Errno::ENOENT, OpenURI::HTTPError, etc...)
end
:s3_bucket => "xyz"