Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NameError (uninitialized constant Aws::VERSION):

I am integrating paperclip with S3 bucket in RAILS 5. I am referring https://coderwall.com/p/vv1iwg/set-up-ruby-on-rails-with-paperclip-5-and-s3-using-aws-sdk-v2. I have written the following in my development.rb:

  config.paperclip_defaults = {
    storage: :s3,
    s3_region: 'us-west-2',
    s3_credentials: {
      bucket: 'mybucket',
      access_key_id: 'my id',
      secret_access_key: 'my secret key'
      }
    } 

I am getting the below error while uploading image:

NameError (uninitialized constant Aws::VERSION):

I am using version 3.0.1 of gem aws-sdk

like image 676
Chakreshwar Sharma Avatar asked Jan 03 '23 11:01

Chakreshwar Sharma


1 Answers

Instead of downgrading, you can introduce the variable that paperclip is missing in the current version. Adding this file works with aws-sdk 3.0.1 and paperclip 5.1.0, and will probably work until paperclip is updated to accommodate the aws changes.

# config/initializers/aws.rb
Aws::VERSION =  Gem.loaded_specs["aws-sdk"].version
like image 174
Peter DeWeese Avatar answered Jan 13 '23 09:01

Peter DeWeese