cirandas.net

ref: master

app/sweepers/category_sweeper.rb


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
class CategorySweeper < ActiveRecord::Observer
  observe :category
  include SweeperHelper

  def after_save(category)
    expire_blocks_cache(category.environment, [:category])

    # Needed for environments with application layout
    expire_fragment(category.environment.id.to_s + "_categories_menu")
  end

  def after_destroy(category)
    expire_blocks_cache(category.environment, [:category])
  end
end