Sha256: 239fbbae0a106f3e591636a721aec4e7a083dbb08c2cb73675825b7ea6c92382

Contents?: true

Size: 730 Bytes

Versions: 1

Compression:

Stored size: 730 Bytes

Contents

# encoding: utf-8

class ArticlesCacheWorker
  include Sidekiq::Worker
  sidekiq_options queue: "default"

  def perform
    #cache leeren
    Goldencobra::Article.active.each do |article|
      article.updated_at = Time.now
      article.without_versioning :save
    end
    #Alte Versionen von has_paper_trail löschen (https://github.com/airblade/paper_trail)
    if ActiveRecord::Base.connection.table_exists?("goldencobra_settings")
      if Goldencobra::Setting.for_key("goldencobra.remove_old_versions.active") == "true"
        weekcount = Goldencobra::Setting.for_key("goldencobra.remove_old_versions.weeks").to_i
        PaperTrail::Version.delete_all ["created_at < ?", weekcount.weeks.ago]
      end
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
goldencobra-1.4.27 app/worker/articles_cache_worker.rb