Class: Question
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Question
show all
- Defined in:
- app/models/question.rb
Constant Summary
collapse
- TYPES =
['TextQuestion', 'EssayQuestion', 'ChooseOneQuestion', 'ChecklistQuestion', 'UploadQuestion', 'FormSection']
Instance Method Summary
collapse
Instance Method Details
#attributes_protected_by_default ⇒ Object
22
23
24
25
26
|
# File 'app/models/question.rb', line 22
def attributes_protected_by_default
default = [ self.class.primary_key ]
default << 'id' unless self.class.primary_key.eql? 'id'
default
end
|
#choice_names ⇒ Object
37
38
39
40
|
# File 'app/models/question.rb', line 37
def choice_names
return [] unless supports_choices
self.choices.map(&:name)
end
|
#rhetorical? ⇒ Boolean
This just means it doesn’t expect an answer, such as a form_section question
29
30
31
|
# File 'app/models/question.rb', line 29
def rhetorical?
false
end
|
#supports_choices ⇒ Object
33
34
35
|
# File 'app/models/question.rb', line 33
def supports_choices
false
end
|
#supports_multiple_answers? ⇒ Boolean
42
43
44
|
# File 'app/models/question.rb', line 42
def supports_multiple_answers?
false
end
|
#supports_uploads? ⇒ Boolean
46
47
48
|
# File 'app/models/question.rb', line 46
def supports_uploads?
false
end
|