Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/65.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails Carrierwave+;雾+;缓存_Ruby On Rails_Ruby_Amazon Web Services_Carrierwave_Fog - Fatal编程技术网

Ruby on rails Carrierwave+;雾+;缓存

Ruby on rails Carrierwave+;雾+;缓存,ruby-on-rails,ruby,amazon-web-services,carrierwave,fog,Ruby On Rails,Ruby,Amazon Web Services,Carrierwave,Fog,场景:我们网站上有一些用户之前上传过他们网站的徽标。最近,我们更改了此徽标的尺寸,并希望所有帐户都反映此更改(我们还从应用程序中删除了retina_rails)。因此,我们计划进行迁移,以删除视网膜导轨,同时通过每个帐户循环,并重新上传徽标,使所有徽标正常化 目前,迁移是这样的: class RemoveRetinaDimensionsFromAccounts < ActiveRecord::Migration def change remove_column :account

场景:我们网站上有一些用户之前上传过他们网站的徽标。最近,我们更改了此徽标的尺寸,并希望所有帐户都反映此更改(我们还从应用程序中删除了retina_rails)。因此,我们计划进行迁移,以删除视网膜导轨,同时通过每个帐户循环,并重新上传徽标,使所有徽标正常化

目前,迁移是这样的:

class RemoveRetinaDimensionsFromAccounts < ActiveRecord::Migration
  def change
    remove_column :accounts, :retina_dimensions, :text
  end

  ActsAsTenant.configure.require_tenant = false
  Account.all.each do |account|
    if account.logo?
        account.logo.cache_stored_file!
        account.logo.retrieve_from_cache!(account.logo.cache_name)
            account.logo.recreate_versions!(:small, :small)
            account.save!
        end
  end
  ActsAsTenant.configure.require_tenant = true
end
CarrierWave.configure do |config|
  if Rails.env.test?
    config.storage = :file
    config.enable_processing = false

  elsif Rails.env.development?
    config.storage = :file
    config.cache_dir = "#{Rails.root}/tmp/uploads"

  elsif Rails.env.staging?
    config.storage = :fog
    config.cache_dir = "#{Rails.root}/tmp/uploads"
    config.fog_credentials = {
      :provider               => 'AWS',                                           # required
      :aws_access_key_id      => Rails.application.secrets.aws_access_key_id,     # required
      :aws_secret_access_key  => Rails.application.secrets.aws_secret_access_key, # required
      :region                 => 'us-west-2'                                      # optional, defaults to 'us-east-1'
    }
    config.fog_directory  = 'blvd-staging'                                        # required
    config.fog_public     = false 
 end
end
我试着遵循这个链接中提到的建议,但它不起作用。我已经测试过了,以确保缓存正在保存文件,并且确实如此。但是,当我尝试从\u缓存中检索\u时!我无法这样做(因为缓存的文件没有名称)

这就是我的缓存文件的外观:

tmp 上传 ##########-#####-####


谢谢。

事实证明,我没有在迁移中的更改块中运行所需的代码块,因此代码从未被执行