Class: ArticlesCacheWorker

Inherits:
Object
  • Object
show all
Includes:
Sidekiq::Worker
Defined in:
app/worker/articles_cache_worker.rb

Instance Method Summary collapse

Instance Method Details

#performObject



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/worker/articles_cache_worker.rb', line 7

def perform
  #cache leeren
  Goldencobra::Article.active.each do |article|
    article.touch
  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