简体   繁体   中英

Issue with Paperclip/S3 in Rails 3.2.5 “cannot load such file — aws-sdk”

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!!

A little embarrassing... I just needed to restart rails server. Can't believe I forgot to do that.

如果在需要aws-sdk的文件顶部添加require 'rubygems' ,会发生什么情况?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM