CarrierWave / Fog / S3 - “不是公认的存储提供商”

时间:2015-04-19 13:35:24

标签: ruby-on-rails heroku amazon-s3 carrierwave fog

在制作中使用Heroku,我的图片上传工作正常,在视图中显示得很好 - 但是,现在我尝试将文件名作为URL的一部分打印,并且它返回{{{ 1}}代码Is not a recognized storage provider - 我的假设是它出现在'LOGO' => "https://wifiuploads.s3.amazonaws.com/uploads/user/logourl/#{user.id}/#{user.logourl.file.filename}",上,因为我的用户模型上的图片上传列 - 我试图做的就是打印文件名进入网址。

我的s3.rb配置:

user.logourl.file.filename

我的上传者/ image_uploader.rb

CarrierWave.configure do |config|
  config.fog_credentials = {
    :provider               => 'aws',
    :aws_access_key_id      => ENV['S3_KEY'],
    :aws_secret_access_key  => ENV['S3_SECRET'],
    :region => ENV['S3_REGION']
  }
  config.fog_directory = ENV['S3_BUCKET']
end

宝石应该是最新的,因为我没有指定特定的版本。宝石如下:

# encoding: utf-8

class ImageUploader < CarrierWave::Uploader::Base

  # Include RMagick or MiniMagick support:
  # include CarrierWave::RMagick
  include CarrierWave::MiniMagick

  # Choose what kind of storage to use for this uploader:
  # storage :file

  storage :fog

  # Override the directory where uploaded files will be stored.
  # This is a sensible default for uploaders that are meant to be mounted:
  def store_dir
    "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
  end

有什么想法?如果我还有任何其他信息,请告诉我。

0 个答案:

没有答案