Sha256: edb7ecc9cc8e0366d4d6d9303c1f4393c8b2376f1c24d052433b49c0a3d53bab

Contents?: true

Size: 450 Bytes

Versions: 10

Compression:

Stored size: 450 Bytes

Contents

module Gaku
  class Guardian < ActiveRecord::Base
    include Person, Addresses, Contacts, Picture

    belongs_to :user
    has_many :student_guardians, dependent: :destroy
    has_many :students, through: :student_guardians

    after_create :reset_student_count
    after_destroy :reset_student_count

    private

    def reset_student_count
      students.each do |s|
        Student.reset_counters(s.id, :guardians)
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
gaku-0.2.4 core/app/models/gaku/guardian.rb
gaku_core-0.2.4 app/models/gaku/guardian.rb
gaku-0.2.3 core/app/models/gaku/guardian.rb
gaku_core-0.2.3 app/models/gaku/guardian.rb
gaku-0.2.2 core/app/models/gaku/guardian.rb
gaku_core-0.2.2 app/models/gaku/guardian.rb
gaku-0.2.1 core/app/models/gaku/guardian.rb
gaku_core-0.2.1 app/models/gaku/guardian.rb
gaku-0.2.0 core/app/models/gaku/guardian.rb
gaku_core-0.2.0 app/models/gaku/guardian.rb