Class: Fe::ReferenceQuestion
- Defined in:
- app/models/fe/reference_question.rb
Instance Attribute Summary
Attributes inherited from Question
Instance Method Summary collapse
- #display_response(app = nil) ⇒ Object
- #has_response?(app = nil) ⇒ Boolean
-
#ptemplate ⇒ Object
which view to render this element?.
- #response(app = nil) ⇒ Object
Methods inherited from Question
#default_label?, #locked?, #responses, #save_file, #save_response, #set_response, #validation_class
Methods inherited from Element
#all_elements, #conditional_match, #content, #duplicate, #hidden?, #hidden_by_choice_field?, #hidden_by_conditional?, #label, #limit, max_label_length, #page_id, #pages_on, #position, #previous_element, #question?, #required?, #reuseable?, #set_conditional_element, #set_position, #tooltip, #update_any_previous_conditional_elements, #update_page_all_element_ids, #visible?
Instance Method Details
#display_response(app = nil) ⇒ Object
22 23 24 |
# File 'app/models/fe/reference_question.rb', line 22 def display_response(app=nil) response(app).to_s end |
#has_response?(app = nil) ⇒ Boolean
13 14 15 16 17 18 19 20 |
# File 'app/models/fe/reference_question.rb', line 13 def has_response?(app = nil) if app reference = response(app) reference && reference.valid? else Fe::ReferenceSheet.where(:question_id => id).count > 0 end end |
#ptemplate ⇒ Object
which view to render this element?
27 28 29 |
# File 'app/models/fe/reference_question.rb', line 27 def ptemplate "fe/reference_#{style}" end |
#response(app = nil) ⇒ Object
6 7 8 9 10 11 |
# File 'app/models/fe/reference_question.rb', line 6 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 = Fe::ReferenceSheet.find_by_applicant_answer_sheet_id_and_question_id(app.id, id) reference || Fe::ReferenceSheet.create(:applicant_answer_sheet_id => app.id, :question_id => id) end |