我有一个使用 Carrierwave 上传文件的 Rails 4 应用程序。安装 Fog 将文件上传到 Amazon 3 后,我在上传文件时开始收到以下错误:
Excon::Errors::SocketError in VideosController#create
Unable to verify certificate, please set `Excon.defaults[:ssl_ca_path] = path_to_certs`, `ENV['SSL_CERT_DIR'] = path_to_certs`, `Excon.defaults[:ssl_ca_file] = path_to_file`, `ENV['SSL_CERT_FILE'] = path_to_file`, `Excon.defaults[:ssl_verify_callback] = callback` (see OpenSSL::SSL::SSLContext#verify_callback), or `Excon.defaults[:ssl_verify_peer] = false` (less secure).
我很困惑,因为我已将“SSL_CERT_FILE”添加到我的环境路径中(通过控制面板在用户和系统变量下),将其设置为 c:/RailsInstaller/cacert.pem (并重新启动了我的计算机)。
当我的控制器在controllers/videos_controller中调用@video.save时,出现错误:
class SessionsController < ApplicationController
def create
@video = Video.new(video_params)
if @video.save
redirect_to videos_path, notice: "Video has been uploaded."
else
render "new"
end
end
private
def video_params
params.require(:video).permit(:name, :attachment)
end
end
我使用的是 Windows 7,使用 ruby 1.9.3p484 和 RubyGems 2.2.2。有人可以帮助我了解此错误的原因以及如何修复它吗?