Sha256: 851c4fcc6690e98d5a9d7606d4734b78494f18aa248d1391ab77a40ab6edab34

Contents?: true

Size: 706 Bytes

Versions: 10

Compression:

Stored size: 706 Bytes

Contents

class CirculationSweeper < ActionController::Caching::Sweeper
  observe Basket, Checkin, Checkout, Reserve
  include ExpireEditableFragment

  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)
    when record.is_a?(Reserve)
      expire_editable_fragment(record.manifestation)
    end
  end

  def after_destroy(record)
    after_save(record)
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
enju_circulation-0.1.0.pre36 app/models/circulation_sweeper.rb
enju_circulation-0.1.0.pre35 app/models/circulation_sweeper.rb
enju_circulation-0.1.0.pre34 app/models/circulation_sweeper.rb
enju_circulation-0.1.0.pre33 app/models/circulation_sweeper.rb
enju_circulation-0.1.0.pre32 app/models/circulation_sweeper.rb
enju_circulation-0.1.0.pre31 app/models/circulation_sweeper.rb
enju_circulation-0.1.0.pre30 app/models/circulation_sweeper.rb
enju_circulation-0.1.0.pre29 app/models/circulation_sweeper.rb
enju_circulation-0.1.0.pre28 app/models/circulation_sweeper.rb
enju_circulation-0.1.0.pre27 app/models/circulation_sweeper.rb