我在我的ruby on rails项目中使用paperclip
。我通过paperclip
gem在我的主页上有一个附件。
has_mongoid_attached_file :profile_doc
我的页面中有此代码,错误来自此处
object.profile_doc.exists?
每当我访问我的主页时,都无法显示我的页面。它可能会显示或通过错误显示NameError: uninitialized constant AWS::S3::Client::V20060301
。有时主页显示成功但不是所有时间。如果我想看到我的主页,那么我需要多次刷新。
我的宝石是
gem 'paperclip', '= 3.5.2'
gem 'aws-sdk', "1.61.0"
由于此错误,我无法使用gem 'aws-sdk', "2"
NameError (uninitialized constant Paperclip::Storage::S3::AWS):请提出任何建议。
我的回溯
/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"