Class: Answer

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/answer.rb

Instance Method Summary collapse

Instance Method Details

#fails_required?Boolean

This method is used to see if the answer fails to meat “required” status if the question is required.

should return true on fail and nil/false on success.

Returns:

  • (Boolean)


27
28
29
30
31
32
33
34
35
# File 'app/models/answer.rb', line 27

def fails_required?
  if question.required
    if question.supports_uploads?
      uploaded_file.blank?
    else
      answer.blank?
    end
  end
end

#to_sObject



17
18
19
20
21
22
23
# File 'app/models/answer.rb', line 17

def to_s
  if question.supports_uploads?
    self.uploaded_file.url
  else
    self.answer.to_s
  end
end