Search code examples
ruby-on-railsamazon-web-servicespaperclipspree

uninitialized constant Aws::VERSION - Spree


I'm trying to upload Spree images to S3. but I'm having trouble to do it.

I get this error:

   raise e
        end
        if Gem::Version.new(Aws::VERSION) >= Gem::Version.new(2) &&
           Gem::Version.new(Aws::VERSION) <= Gem::Version.new("2.0.33")
          raise LoadError, "paperclip does not support aws-sdk versions 2.0.0 - 2.0.33.  Please upgrade aws-sdk to a newer version."
        end

For my understood the aws version needs to be upper to 2.0.33, but as you can see, this is my gemfile

#aws
gem 'aws-sdk', '~> 3'

Also I don't have gem for paperclip. Need to add one?


Solution

  • Ok, "fixed it". It's a problem with paperclip and the latest version of aws.

    There's two work around:

    first:

    gem 'aws-sdk', '< 3.0'
    

    secod:

    # config/initializers/aws.rb
    Aws::VERSION =  Gem.loaded_specs["aws-sdk"].version