Method: Qe::ReferenceQuestion#response
- Defined in:
- app/models/qe/reference_question.rb
#response(app = nil) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/models/qe/reference_question.rb', line 7 def response(app=nil) return unless app # A reference is the same if the related_question_sheet corresponding to the question is the same reference = ReferenceSheet.find_by_applicant_answer_sheet_id_and_question_id(app.id, id) # if references.present? # reference = references.detect {|r| r.question_id == id } # # If they have another reference that matches this question id, don't go fishing for another one # unless reference # # If the question_id doesn't match, but the reference question is based on the same reference template (question sheet) # # update the reference with the new question_id # reference = references.detect {|r| r.question.related_question_sheet_id == related_question_sheet_id} # reference.update_attribute(:question_id, id) if reference # end # end reference || ReferenceSheet.create(:applicant_answer_sheet_id => app.id, :question_id => id) end |