Class: CirculationSweeper

Inherits:
ActionController::Caching::Sweeper
  • Object
show all
Includes:
ExpireEditableFragment
Defined in:
app/models/circulation_sweeper.rb

Instance Method Summary collapse

Instance Method Details

#after_destroy(record) ⇒ Object



19
20
21
# File 'app/models/circulation_sweeper.rb', line 19

def after_destroy(record)
  after_save(record)
end

#after_save(record) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/models/circulation_sweeper.rb', line 5

def after_save(record)
  case
  when record.is_a?(Basket)
    record.checkouts.each do |checkout|
      expire_editable_fragment(checkout.item)
      expire_editable_fragment(checkout.item.manifestation)
    end
  when record.is_a?(Checkin)
    expire_editable_fragment(record.item.manifestation)
  when record.is_a?(Checkout)
    expire_editable_fragment(record.item.manifestation)
  end
end