diff --git a/app/sweepers/article_sweeper.rb b/app/sweepers/article_sweeper.rb index a984b7d..cc1f600 100644 --- a/app/sweepers/article_sweeper.rb +++ b/app/sweepers/article_sweeper.rb @@ -10,10 +10,16 @@ class ArticleSweeper < ActiveRecord::Observer expire_caches(article) end + def before_update(article) + if article.parent_id_change + Article.find(article.parent_id_was).touch if article.parent_id_was + end + end + protected def expire_caches(article) - article.hierarchy.each { |a| a.touch if a != article } + article.hierarchy(true).each { |a| a.touch if a != article } blocks = article.profile.blocks blocks += article.profile.environment.blocks if article.profile.environment blocks = blocks.select{|b|[RecentDocumentsBlock, BlogArchivesBlock].any?{|c| b.kind_of?(c)}} -- libgit2 0.21.2