Class: Peoplefinder::Person
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Peoplefinder::Person
- Extended by:
- FriendlyId
- Includes:
- Concerns::Authentication, Concerns::Completion, Concerns::Notifications, Concerns::Searchable, Concerns::WorkDays
- Defined in:
- app/models/peoplefinder/person.rb
Instance Attribute Summary collapse
-
#crop_h ⇒ Object
Returns the value of attribute crop_h.
-
#crop_w ⇒ Object
Returns the value of attribute crop_w.
-
#crop_x ⇒ Object
Returns the value of attribute crop_x.
-
#crop_y ⇒ Object
Returns the value of attribute crop_y.
-
#role_names ⇒ Object
Returns the value of attribute role_names.
Class Method Summary collapse
Instance Method Summary collapse
- #name ⇒ Object
- #path(hint_group = nil) ⇒ Object
- #phone ⇒ Object
- #role_and_group ⇒ Object
- #slug_source ⇒ Object
- #support_email ⇒ Object
- #to_s ⇒ Object
Instance Attribute Details
#crop_h ⇒ Object
Returns the value of attribute crop_h.
16 17 18 |
# File 'app/models/peoplefinder/person.rb', line 16 def crop_h @crop_h end |
#crop_w ⇒ Object
Returns the value of attribute crop_w.
16 17 18 |
# File 'app/models/peoplefinder/person.rb', line 16 def crop_w @crop_w end |
#crop_x ⇒ Object
Returns the value of attribute crop_x.
16 17 18 |
# File 'app/models/peoplefinder/person.rb', line 16 def crop_x @crop_x end |
#crop_y ⇒ Object
Returns the value of attribute crop_y.
16 17 18 |
# File 'app/models/peoplefinder/person.rb', line 16 def crop_y @crop_y end |
#role_names ⇒ Object
Returns the value of attribute role_names.
16 17 18 |
# File 'app/models/peoplefinder/person.rb', line 16 def role_names @role_names end |
Class Method Details
.namesakes(person) ⇒ Object
32 33 34 35 36 |
# File 'app/models/peoplefinder/person.rb', line 32 def self.namesakes(person) where(surname: person.surname). where(given_name: person.given_name). where.not(id: person.id) end |
Instance Method Details
#name ⇒ Object
38 39 40 |
# File 'app/models/peoplefinder/person.rb', line 38 def name [given_name, surname].compact.join(' ').strip end |
#path(hint_group = nil) ⇒ Object
58 59 60 |
# File 'app/models/peoplefinder/person.rb', line 58 def path(hint_group = nil) group_path(hint_group) + [self] end |
#phone ⇒ Object
62 63 64 65 |
# File 'app/models/peoplefinder/person.rb', line 62 def phone return primary_phone_number if primary_phone_number.present? return secondary_phone_number if secondary_phone_number.present? end |
#role_and_group ⇒ Object
54 55 56 |
# File 'app/models/peoplefinder/person.rb', line 54 def role_and_group memberships.map { |m| [m.group_name, m.role].join(', ') }.join('; ') end |
#slug_source ⇒ Object
46 47 48 49 50 51 52 |
# File 'app/models/peoplefinder/person.rb', line 46 def slug_source if email.present? email.split(/@/).first else name end end |
#support_email ⇒ Object
67 68 69 70 71 72 73 |
# File 'app/models/peoplefinder/person.rb', line 67 def support_email if groups.present? groups.first.team_email_address else Rails.configuration.support_email end end |
#to_s ⇒ Object
42 43 44 |
# File 'app/models/peoplefinder/person.rb', line 42 def to_s name end |