Reputation: 2382
I am trying to integrate amazon s3 in my project. The Gemfile is as follows.
gem 'paperclip', '~> 5.0.0'
gem 'aws-sdk-s3'
development.rb
config.paperclip_defaults = {
:storage => :s3,
:bucket => 'name_ofbucket'
}
Paperclip.options[:command_path] = "/usr/local/bin/"
config/aws.yml
development:
access_key_id: AWS_ACCESS_KEY_ID
secret_access_key: AWS_SECRET_KEY_ID
production:
access_key_id: AWS_ACCESS_KEY_ID
secret_access_key: AWS_SECRET_KEY_ID
Model
has_attached_file :logo, styles: { medium: '300x300>', thumb: '150x150>' },
:storage => :s3,
:s3_credentials => "#{Rails.root}/config/aws.yml",
:path => ":class/:attachment/:token/:style.:extension",
:bucket => 'name_of_bucket',
default_url: '/images/missing.jpg'
Now i am getting the following error.
cannot load such file -- aws-sdk (You may need to install the aws-sdk gem)
I have already installed the gems and restarted the server. I went through similar threads but could not resolve the issue.
I am not sure why i am receiving this error. Any help would be appreciated.
Upvotes: 0
Views: 1668
Reputation: 2321
For me it was because of I added the amazon s3_region wrong If you are using S3 storage, aws-sdk >= 2.0.0 requires you to make a few small changes:
s3_region
:public_read
needs to be changed to
public-read
.Upvotes: 0
Reputation: 12719
Your Gemfile declares:
gem 'aws-sdk-s3'
Whereas the error message says:
cannot load such file -- aws-sdk (You may need to install the aws-sdk gem)
Have you tried to put gem 'aws-sdk'
in your Gemfile?
I know you just want to use s3
and not the whole aws-sdk
, but maybe paperclip
requires a few more library to be loaded than the bar minimum.
Upvotes: 1