图像上传工作正常,但当我尝试将其切换到S3时,它开始抛出错误。我尝试创建新的图片上传时出现以下错误:
cannot load such file -- aws-sdk (You may need to install the aws-sdk gem)
相关宝石:
gem 'rails', '3.2.5'
gem 'paperclip'
gem 'aws-sdk'
配置/ s3.yml:
development:
bucket: bucketname
access_key_id: #
secret_access_key: #
test:
bucket: bucketname
access_key_id: #
secret_access_key: #
image_upload.rb:
has_attached_file :image,
:styles => {
:normal => "1680x6000",
:result => "560x3000",
:thumb => "140x500" },
:path => ":attachment/:style/:normalized_file_name.:extension",
:storage => :s3,
:s3_credentials => "#{Rails.root}/config/s3.yml"
我尝试过的事情:
感谢您的帮助!!
答案 0 :(得分:6)
有点尴尬......我只需要重新启动rails服务器。我不敢相信我忘了这么做。
答案 1 :(得分:0)
如果您将require 'rubygems'
添加到需要aws-sdk的文件顶部会发生什么?