Sha256: 73b0be702bd5ce1698b3bea6267c219dff7c47d6c12e5cc0e840fb9914d86dd3

Contents?: true

Size: 1.27 KB

Versions: 39

Compression:

Stored size: 1.27 KB

Contents

class PageSweeper < ActionController::Caching::Sweeper
  include ExpireEditableFragment
  observe Create, Realize, Produce, Own, Exemplify,
    SeriesStatement, SeriesHasManifestation, PictureFile

  def after_save(record)
    case record.class.to_s.to_sym
    when :Create
      expire_editable_fragment(record.patron)
      expire_editable_fragment(record.work)
    when :Realize
      expire_editable_fragment(record.patron)
      expire_editable_fragment(record.expression)
    when :Produce
      expire_editable_fragment(record.patron)
      expire_editable_fragment(record.manifestation)
    when :Own
      expire_editable_fragment(record.patron)
      expire_editable_fragment(record.item)
      expire_editable_fragment(record.item.manifestation)
    when :Exemplify
      expire_editable_fragment(record.manifestation)
      expire_editable_fragment(record.item)
    when :SeriesStatement
      record.manifestations.each do |manifestation|
        expire_editable_fragment(manifestation)
      end
    when :SeriesHasManifestation
      expire_editable_fragment(record.manifestation)
    when :PictureFile
      if record.picture_attachable_type?
        expire_editable_fragment(record.picture_attachable)
      end
    end
  end

  def after_destroy(record)
    after_save(record)
  end
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
enju_biblio-0.1.0.pre33 app/models/page_sweeper.rb
enju_biblio-0.1.0.pre32 app/models/page_sweeper.rb
enju_biblio-0.1.0.pre31 app/models/page_sweeper.rb
enju_biblio-0.1.0.pre30 app/models/page_sweeper.rb
enju_biblio-0.1.0.pre29 app/models/page_sweeper.rb
enju_biblio-0.1.0.pre28 app/models/page_sweeper.rb
enju_biblio-0.1.0.pre27 app/models/page_sweeper.rb
enju_biblio-0.1.0.pre26 app/models/page_sweeper.rb
enju_biblio-0.1.0.pre25 app/models/page_sweeper.rb
enju_biblio-0.1.0.pre24 app/models/page_sweeper.rb
enju_biblio-0.1.0.pre23 app/models/page_sweeper.rb
enju_biblio-0.1.0.pre22 app/models/page_sweeper.rb
enju_biblio-0.1.0.pre21 app/models/page_sweeper.rb
enju_biblio-0.1.0.pre20 app/models/page_sweeper.rb
enju_biblio-0.1.0.pre19 app/models/page_sweeper.rb
enju_biblio-0.1.0.pre18 app/models/page_sweeper.rb
enju_biblio-0.1.0.pre17 app/models/page_sweeper.rb
enju_biblio-0.1.0.pre16 app/models/page_sweeper.rb
enju_biblio-0.1.0.pre15 app/models/page_sweeper.rb
enju_biblio-0.1.0.pre14 app/models/page_sweeper.rb