Class: Person

Inherits:
Object
  • Object
show all
Includes:
Employee, Mongoid::Document, Mongoid::History::Trackable, Student
Defined in:
lib/trogdir/person.rb

Constant Summary collapse

GENDERS =
[:male, :female]

Instance Method Summary collapse

Instance Method Details

#changesetsObject



68
69
70
71
72
# File 'lib/trogdir/person.rb', line 68

def changesets
  # association_hash is provided by Mongoid::History::Trackable
  # history_tracks would only get changes to the 'person' scope this also gets changes to associated models
  Mongoid::History.tracker_class.where(association_chain: association_hash)
end

#emailObject



74
75
76
# File 'lib/trogdir/person.rb', line 74

def email
  emails.where(primary: true).first
end