Sha256: 69cbb8bba1a8c146f9e4836c1d81cafcd0e4f4e9ea02aef33a462babb72b047a

Contents?: true

Size: 933 Bytes

Versions: 26

Compression:

Stored size: 933 Bytes

Contents

class SubjectSweeper < ActionController::Caching::Sweeper
  observe Subject, Classification,  SubjectHeadingTypeHasSubject, WorkHasSubject, SubjectHeadingType
  include ExpireEditableFragment

  def after_save(record)
    case record.to_s.to_sym
    when :Subject
      expire_editable_fragment(record)
      record.works.each do |work|
        expire_editable_fragment(work)
      end
      record.classifications.each do |classification|
        expire_editable_fragment(classification)
      end
    when :Classification
      expire_editable_fragment(record)
      record.subjects.each do |subject|
        expire_editable_fragment(subject)
      end
    when :SubjectHeadingTypeHasSubject
      expire_editable_fragment(record.subject)
    when :WorkHasSubject
      expire_editable_fragment(record.work)
      expire_editable_fragment(record.subject)
    end
  end

  def after_destroy(record)
    after_save(record)
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
enju_subject-0.1.0.pre12 app/models/subject_sweeper.rb
enju_subject-0.1.0.pre11 app/models/subject_sweeper.rb
enju_subject-0.1.0.pre10 app/models/subject_sweeper.rb
enju_subject-0.1.0.pre9 app/models/subject_sweeper.rb
enju_subject-0.1.0.pre8 app/models/subject_sweeper.rb
enju_subject-0.1.0.pre7 app/models/subject_sweeper.rb
enju_subject-0.1.0.pre6 app/models/subject_sweeper.rb
enju_subject-0.1.0.pre5 app/models/subject_sweeper.rb
enju_subject-0.1.0.pre4 app/models/subject_sweeper.rb
enju_subject-0.1.0.pre3 app/models/subject_sweeper.rb
enju_subject-0.1.0.pre2 app/models/subject_sweeper.rb
enju_subject-0.1.0.pre app/models/subject_sweeper.rb
enju_subject-0.0.18 app/models/subject_sweeper.rb
enju_subject-0.0.17 app/models/subject_sweeper.rb
enju_subject-0.0.16 app/models/subject_sweeper.rb
enju_subject-0.0.15 app/models/subject_sweeper.rb
enju_subject-0.0.14 app/models/subject_sweeper.rb
enju_subject-0.0.13 app/models/subject_sweeper.rb
enju_subject-0.0.12 app/models/subject_sweeper.rb
enju_subject-0.0.10 app/models/subject_sweeper.rb