问题
Image Uploading was working fine, but when I tried switching it to S3, it started throwing an error. I get the following error when I try to create a new image upload:
cannot load such file -- aws-sdk (You may need to install the aws-sdk gem)
Relevant gems:
gem 'rails', '3.2.5'
gem 'paperclip'
gem 'aws-sdk'
config/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"
Things I have tried:
- bundle install
- Change the version of aws-sdk to 1.3.4
- gem install aws-sdk
- Changed the s3_credentials "Rails.root" part to a few different things.
Thank you for the help!!
回答1:
A little embarrassing... I just needed to restart rails server. Can't believe I forgot to do that.
回答2:
What happens if you add require 'rubygems'
to the top of the file where you are requiring aws-sdk?
来源:https://stackoverflow.com/questions/11236847/issue-with-paperclip-s3-in-rails-3-2-5-cannot-load-such-file-aws-sdk