1

I am using paperclip on my ruby on rails project. I have an attachment in my home page through paperclip gem.

has_mongoid_attached_file :profile_doc 

I have this code in my page and error comes from here

object.profile_doc.exists?

Whenever I visit my home page it is not promising to show my page. It may show or through an error as NameError: uninitialized constant AWS::S3::Client::V20060301. Some times home page shows successful but not all the times. If I want to see my home page then I need to refresh multiple times.

my gems are

gem 'paperclip', '= 3.5.2'
gem 'aws-sdk', "1.61.0"

I could not use gem 'aws-sdk', "2" because of this error NameError (uninitialized constant Paperclip::Storage::S3::AWS): Any advise please.

My backtrace

    /vendor/bundle/ruby/1.9.1/gems/aws-sdk-v1-1.61.0/lib/aws/core/client.rb:634 in "const_get"
    /vendor/bundle/ruby/1.9.1/gems/aws-sdk-v1-1.61.0/lib/aws/core/client.rb:634 in "client_class"
    /vendor/bundle/ruby/1.9.1/gems/aws-sdk-v1-1.61.0/lib/aws/core/client.rb:623 in "new"
    /vendor/bundle/ruby/1.9.1/gems/aws-sdk-v1-1.61.0/lib/aws/core/configuration.rb:474 in "block in add_service"
    /vendor/bundle/ruby/1.9.1/gems/aws-sdk-v1-1.61.0/lib/aws/core/configuration.rb:387 in "call"
    /vendor/bundle/ruby/1.9.1/gems/aws-sdk-v1-1.61.0/lib/aws/core/configuration.rb:387 in "block in add_option_with_needs"
    /vendor/bundle/ruby/1.9.1/gems/aws-sdk-v1-1.61.0/lib/aws/core/service_interface.rb:73 in "initialize"
    /vendor/bundle/ruby/1.9.1/gems/paperclip-3.5.2/lib/paperclip/storage/s3.rb:227 in "new"
    /vendor/bundle/ruby/1.9.1/gems/paperclip-3.5.2/lib/paperclip/storage/s3.rb:227 in "obtain_s3_instance_for"
    /vendor/bundle/ruby/1.9.1/gems/paperclip-3.5.2/lib/paperclip/storage/s3.rb:221 in "s3_interface"
    /vendor/bundle/ruby/1.9.1/gems/paperclip-3.5.2/lib/paperclip/storage/s3.rb:231 in "s3_bucket"
    /vendor/bundle/ruby/1.9.1/gems/paperclip-3.5.2/lib/paperclip/storage/s3.rb:235 in "s3_object"
    /vendor/bundle/ruby/1.9.1/gems/paperclip-3.5.2/lib/paperclip/storage/s3.rb:272 in "exists?"
    /app/views/companies/_profile_controls.html.haml:23 in "_app_views_companies__profile_controls_html_haml__3018439796727520142_61431740"
Community
  • 1
  • 1
Selvamani
  • 7,434
  • 4
  • 32
  • 43
  • How about update `paperclip` and `aws-sdk` gems together? – Maxim Mar 18 '15 at 14:01
  • it was working fine today morning itself. From morning onward it's stop working. `paperclip` depense on `aws-sdk`. So that's why I specified which version it should be added on gemlock – Selvamani Mar 18 '15 at 14:45
  • I personally recommend using the `aws-sdk-v1` gem. You simply replace the gem name in your Gemfile and your require statement from `require 'aws-sdk'` to `require 'aws-sdk-v1`'. Its the same gem, but allows you to add v2 of the `aws-sdk` gem to the same application. – Trevor Rowe Mar 19 '15 at 03:50

0 Answers0