Class: DeadSimpleCMS::Rails::ActionView::FragmentSweeper
- Inherits:
-
ActionController::Caching::Sweeper
- Object
- ActionController::Caching::Sweeper
- DeadSimpleCMS::Rails::ActionView::FragmentSweeper
- Defined in:
- lib/dead_simple_cms/rails/action_controller/fragment_sweeper.rb
Overview
Public: Class to handle expiring the fragment caches from the cms. ::ActionController::Caching::Sweeper inherits from ActiveRecord::Observer even though we aren’t observing an ActiveRecord class. This still works though because the interface (update callback) is the same on the Section.
Instance Method Summary collapse
-
#after_save(section) ⇒ Object
Make sure we expire any fragments that we are using on those pages.
Instance Method Details
#after_save(section) ⇒ Object
Make sure we expire any fragments that we are using on those pages.
12 13 14 15 16 17 18 19 20 |
# File 'lib/dead_simple_cms/rails/action_controller/fragment_sweeper.rb', line 12 def after_save(section) section.fragments.each do |fragment| if fragment.is_a?(Hash) && fragment.has_key?(:cell) expire_cell_state(fragment[:cell], fragment[:state]) else expire_fragment(fragment) end end end |