Sha256: 9099824b8bf25b001f9fbda24a754a46b8d38ae21f64189931243f5d57277a88

Contents?: true

Size: 763 Bytes

Versions: 11

Compression:

Stored size: 763 Bytes

Contents

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

  def after_save(record)
    case
    when record.is_a?(Basket)
      record.checkouts.each do |checkout|
        expire_editable_fragment(checkout.item, ['detail'])
        expire_editable_fragment(checkout.item.manifestation, ['holding', 'show_list'], ['html', 'mobile'])
      end
    when record.is_a?(Checkin)
      expire_editable_fragment(record.item.manifestation, ['holding', 'show_list'], ['html', 'mobile'])
    when record.is_a?(Checkout)
      expire_editable_fragment(record.item.manifestation, ['holding', 'show_list'], ['html', 'mobile'])
    end
  end

  def after_destroy(record)
    after_save(record)
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
enju_circulation-0.0.14 app/models/circulation_sweeper.rb
enju_circulation-0.0.13 app/models/circulation_sweeper.rb
enju_circulation-0.0.12 app/models/circulation_sweeper.rb
enju_circulation-0.0.11 app/models/circulation_sweeper.rb
enju_circulation-0.0.10 app/models/circulation_sweeper.rb
enju_circulation-0.0.9 app/models/circulation_sweeper.rb
enju_circulation-0.0.8 app/models/circulation_sweeper.rb
enju_circulation-0.0.7 app/models/circulation_sweeper.rb
enju_circulation-0.0.6 app/models/circulation_sweeper.rb
enju_circulation-0.0.4 app/models/circulation_sweeper.rb
enju_circulation-0.0.3 app/models/circulation_sweeper.rb