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



65
66
67
68
69
# File 'lib/trogdir/person.rb', line 65

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



71
72
73
# File 'lib/trogdir/person.rb', line 71

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