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
24
25
26
27
28
|
# File 'app/models/question.rb', line 24
def attributes_protected_by_default
default = [ self.class.primary_key ]
default << 'id' unless self.class.primary_key.eql? 'id'
default
end
|
#choice_names ⇒ Object
39
40
41
42
|
# File 'app/models/question.rb', line 39
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
31
32
33
|
# File 'app/models/question.rb', line 31
def rhetorical?
false
end
|
#supports_choices ⇒ Object
35
36
37
|
# File 'app/models/question.rb', line 35
def supports_choices
false
end
|
#supports_multiple_answers? ⇒ Boolean
44
45
46
|
# File 'app/models/question.rb', line 44
def supports_multiple_answers?
false
end
|
#supports_uploads? ⇒ Boolean
48
49
50
|
# File 'app/models/question.rb', line 48
def supports_uploads?
false
end
|