Class: Fe::PaymentQuestion

Inherits:
Question show all
Defined in:
app/models/fe/payment_question.rb

Instance Attribute Summary

Attributes inherited from Question

#answers

Instance Method Summary collapse

Methods inherited from Question

#default_label?, #locked?, #required?, #responses, #save_file, #save_response, #set_response, #validation_class

Methods inherited from Element

#all_elements, #duplicate, #limit, max_label_length, #page_id, #position, #ptemplate, #question?, #required?, #reuseable?, #set_position

Instance Method Details

#display_response(answer_sheet = nil) ⇒ Object



9
10
11
# File 'app/models/fe/payment_question.rb', line 9

def display_response(answer_sheet=nil)
  response(answer_sheet).to_s
end

#has_response?(answer_sheet = nil) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
16
17
18
19
# File 'app/models/fe/payment_question.rb', line 13

def has_response?(answer_sheet = nil)
  if answer_sheet
    answer_sheet.payments.length > 0
  else
    false
  end
end

#response(answer_sheet = nil) ⇒ Object



4
5
6
7
# File 'app/models/fe/payment_question.rb', line 4

def response(answer_sheet=nil)
  return Payment.new unless answer_sheet
  answer_sheet.payments || [Payment.new(:answer_sheetlication_id => answer_sheet.id) ]
end