Class: Fe::ReferenceSheet
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Fe::ReferenceSheet
- Includes:
- AASM, AnswerSheetConcern
- Defined in:
- app/models/fe/reference_sheet.rb
Instance Method Summary collapse
- #display_type ⇒ Object
- #email_sent? ⇒ Boolean
- #frozen? ⇒ Boolean
- #generate_access_key ⇒ Object
- #name ⇒ Object
-
#question_sheet ⇒ Object
Can’t rely on answer_sheet’s implementation for old reference’s that might have id’s that may match an application id.
-
#question_sheets ⇒ Object
Can’t rely on answer_sheet’s implementation for old reference’s that might have id’s that may match an application id.
- #reference ⇒ Object
- #reference? ⇒ Boolean
- #required? ⇒ Boolean
-
#send_invite ⇒ Object
send email invite.
- #to_s ⇒ Object
Methods included from AnswerSheetConcern
#answers_by_question, #collat_title, #complete?, #completely_filled_out?, #has_answer_for?, #pages, #percent_complete
Instance Method Details
#display_type ⇒ Object
123 124 125 |
# File 'app/models/fe/reference_sheet.rb', line 123 def display_type question.label.split(/:| \(/).first end |
#email_sent? ⇒ Boolean
62 |
# File 'app/models/fe/reference_sheet.rb', line 62 def email_sent?() !self.email_sent_at.nil? end |
#frozen? ⇒ Boolean
58 59 60 |
# File 'app/models/fe/reference_sheet.rb', line 58 def frozen? !%w(started created).include?(self.status) end |
#generate_access_key ⇒ Object
54 55 56 |
# File 'app/models/fe/reference_sheet.rb', line 54 def generate_access_key self.access_key = Digest::MD5.hexdigest(email + Time.now.to_s) end |
#name ⇒ Object
93 94 95 |
# File 'app/models/fe/reference_sheet.rb', line 93 def name [first_name, last_name].join(' ') end |
#question_sheet ⇒ Object
Can’t rely on answer_sheet’s implementation for old reference’s that might have id’s that may match an application id
114 115 116 |
# File 'app/models/fe/reference_sheet.rb', line 114 def question_sheet QuestionSheet.find(question.) if question && question. end |
#question_sheets ⇒ Object
Can’t rely on answer_sheet’s implementation for old reference’s that might have id’s that may match an application id
119 120 121 |
# File 'app/models/fe/reference_sheet.rb', line 119 def question_sheets [question_sheet] end |
#reference ⇒ Object
97 98 99 |
# File 'app/models/fe/reference_sheet.rb', line 97 def reference self end |
#reference? ⇒ Boolean
109 110 111 |
# File 'app/models/fe/reference_sheet.rb', line 109 def reference? true end |
#required? ⇒ Boolean
105 106 107 |
# File 'app/models/fe/reference_sheet.rb', line 105 def required? question.required?(applicant_answer_sheet) end |
#send_invite ⇒ Object
send email invite
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'app/models/fe/reference_sheet.rb', line 65 def send_invite return if self.email.blank? application = self.applicant_answer_sheet Notifier.notification(self.email, application.email, "Reference Invite", {'reference_full_name' => self.name, 'applicant_full_name' => application.name, 'applicant_email' => application.email, 'applicant_home_phone' => application.phone, 'reference_url' => edit_reference_sheet_url(self, :a => self.access_key, :host => ActionMailer::Base.[:host])}).deliver # Send notification to applicant Notifier.notification(applicant_answer_sheet.email, # RECIPIENTS Fe.from_email, # FROM "Reference Notification to Applicant", # LIQUID TEMPLATE NAME {'applicant_full_name' => applicant_answer_sheet.name, 'reference_full_name' => self.name, 'reference_email' => self.email, 'application_url' => edit_answer_sheet_url(applicant_answer_sheet, :host => ActionMailer::Base.[:host])}).deliver self.email_sent_at = Time.now self.save(:validate => false) true end |
#to_s ⇒ Object
101 102 103 |
# File 'app/models/fe/reference_sheet.rb', line 101 def to_s name end |