gpt4 book ai didi

amazon-s3 - 安装aws-sdk后报错

转载 作者:行者123 更新时间:2023-12-02 22:43:40 24 4
gpt4 key购买 nike

我正在尝试让回形针与 S3 配合使用,但我的 View 出现错误:

cannot load such file -- aws-sdk (You may need to install the aws-sdk gem)

我以这种方式配置了 rails:

gem 文件

...
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

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/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 %>
....

如果您发现任何可能有帮助的不正确之处,请告诉我。谢谢

最佳答案

尝试重新启动您的服务器。我遇到了同样的错误,这对我有用。

关于amazon-s3 - 安装aws-sdk后报错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10369579/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com