Class: Effective::ApplicantEndorsement
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Effective::ApplicantEndorsement
- Defined in:
- app/models/effective/applicant_endorsement.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.endorser_collection(applicant) ⇒ Object
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'app/models/effective/applicant_endorsement.rb', line 63 def self.endorser_collection(applicant) raise('expected an effective memberships applicant') unless applicant.class.try(:effective_memberships_applicant?) collection_method = EffectiveMemberships.applicant_endorsements_endorser_collection() if collection_method.blank? return (applicant.user.class.members) end collection = instance_exec(applicant, &collection_method) unless collection.kind_of?(ActiveRecord::Relation) raise("expected EffectiveMemberships.applicant_endorsements_endorsers_collection to return an ActiveRecord::Relation.") end collection end |
Instance Method Details
#complete! ⇒ Object
96 97 98 99 |
# File 'app/models/effective/applicant_endorsement.rb', line 96 def complete! completed! applicant.save! end |
#email ⇒ Object
85 86 87 |
# File 'app/models/effective/applicant_endorsement.rb', line 85 def email endorser&.email || endorser_email end |
#notify! ⇒ Object
89 90 91 92 93 94 |
# File 'app/models/effective/applicant_endorsement.rb', line 89 def notify! raise('expected endorsement email') unless email.present? EffectiveMemberships.send_email(:applicant_endorsement_notification, self) update!(last_notified_at: Time.zone.now) end |
#to_s ⇒ Object
81 82 83 |
# File 'app/models/effective/applicant_endorsement.rb', line 81 def to_s 'endorsement' end |