安装AWS-SDK后错误 [英] Error after installing aws-sdk
本文介绍了安装AWS-SDK后错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图让回形针与S3工作,我的看法是抛出一个错误:
I am trying to get paperclip to work with S3 and my views are throwing an error:
cannot load such file -- aws-sdk (You may need to install the aws-sdk gem)
我有这样配置的轨道:
I have rails configured this way:
的Gemfile
...
gem "paperclip", "~> 3.0"
gem 'aws-sdk'
...
型号
user.rb
...
has_attached_file :avatar, :styles => { :medium => "300x300>", :thumb => "100x100>" },
:storage => :s3,
:bucket => ENV['lumeo-dev'],
:s3_credentials => "lumeot/config/aws.yml",
:path => "/:style/:id/:filename"
...
配置/ aws.yml
config/aws.yml
development:
bucket: lumeo-dev
access_key_id: #
secret_access_key: #
test:
bucket: lumeo-test
access_key_id: #
secret_access_key: #
production:
bucket: lumeo-pro
access_key_id: #
secret_access_key: #
以#表示正确的ID /键
with "#" denoting the correct id/key
模板:
<%= simple_form_for(resource, :as => resource_name, :url =>
registration_path(resource_name), :html => { :method => :put, :multipart => true }) do |f| %>
<%= f.error_notification %>
<div class="inputs">
<p>
<% if current_user.avatar.present? %>
Change Photo
<%= image_tag @user.avatar.url(:thumb) %>
<% else %>
Upload New Photo
<%= gravatar_for current_user %>
<% end %>
</p>
<%= f.file_field :avatar %>
....
请让我知道如果你看到任何不正确,可能会有所帮助。谢谢
Please let me know if you see anything incorrect that may help. Thanks
推荐答案
错误现在安装了ImageMagick后解决:的 https://github.com/thoughtbot/paperclip/blob/master/README.md
The error is now resolved after installing imageMagick: https://github.com/thoughtbot/paperclip/blob/master/README.md
和配售:
Paperclip.options[:command_path] = "/usr/local/bin/"
在配置/环境/ development.rb,它可以让回形针知道去哪里找ImageMagick的
In config/environments/development.rb, which lets paperclip know where to look for imageMagick
这篇关于安装AWS-SDK后错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文