Ben
Ben

Reputation: 173

Paperclip s3 storage not working with aws-sdk gem

I'm trying to use the paperclip gem to upload photos in my rails project.

I my gem file:

gem "paperclip", "~> 2.4"
gem "aws-sdk"

On my model:

has_attached_file :image,
    :styles => { :large => "600x600>", :standard => "450x450>", :medium => "300x300>", :medium_square => "310x310#", :small => "200x200>", :thumb => "150x150>", :small_square => "50x50#" },
    :storage => :s3,
    :s3_credentials => "#{Rails.root}/config/aws.yml",
    :path => ":id/:hash/:style.:extension",
    :hash_secret => ''

But I keep getting an unitiliazed constant error on AWS::Base? I can't see what's wrong.

Upvotes: 4

Views: 1872

Answers (1)

Slick23
Slick23

Reputation: 5897

The docs are currently wrong. You're reading the master doc, which does tell you to pull ~2.4 and use aws-sdk, but that ~2.4 line actually pulls a version of the gem which is actually different than the branch whose docs you're reading, and that version still uses the old s3 gem.

Change your gemfile to this:

gem 'paperclip', :git => 'git://github.com/thoughtbot/paperclip.git'

And then the aws-sdk gem should work.

Upvotes: 7

Related Questions