Module: SurveyorGui::Models::ResponseMethods
- Included in:
- Response
- Defined in:
- lib/surveyor_gui/models/response_methods.rb
Constant Summary collapse
- VALUE_TYPE =
['float', 'integer', 'string', 'datetime', 'text']
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/surveyor_gui/models/response_methods.rb', line 5 def self.included(base) base.send :has_many, :answers, :primary_key => :answer_id, :foreign_key => :id base.send :has_many, :questions base.send :belongs_to, :column base.send :attr_accessible, :response_set, :question, :answer, :date_value, :time_value, :response_set_id, :question_id, :answer_id, :datetime_value, :integer_value, :float_value, :unit, :text_value, :string_value, :response_other, :response_group, :survey_section_id, :blob, :column if defined? ActiveModel::MassAssignmentSecurity #belongs_to :user # after_destroy :delete_blobs! # after_destroy :delete_empty_dir #extends response to allow file uploads. base.send :mount_uploader, :blob, BlobUploader end |
Instance Method Details
#is_comment? ⇒ Boolean
33 34 35 36 37 38 39 |
# File 'lib/surveyor_gui/models/response_methods.rb', line 33 def is_comment? if self.answer self.answer.is_comment? else false end end |
#response_value ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/surveyor_gui/models/response_methods.rb', line 24 def response_value response_class = self.answer.response_class if self.question.pick=='none' _no_pick_value(response_class) else return self.answer.text end end |