Sha256: 832b3b597fce7780462be805396d6707fc39d2209f8207c76a4000789bed3c28
Contents?: true
Size: 699 Bytes
Versions: 6
Compression:
Stored size: 699 Bytes
Contents
class Response < ActiveRecord::Base include ActionView::Helpers::SanitizeHelper # Associations belongs_to :response_set belongs_to :question belongs_to :answer # Validations validates_presence_of :response_set_id, :question_id, :answer_id acts_as_response # includes "as" instance method def selected !self.new_record? end alias_method :selected?, :selected def selected=(value) true end def to_s if self.answer.response_class == "answer" and self.answer_id return self.answer.text else return "#{(self.string_value || self.text_value || self.integer_value || self.float_value || nil).to_s}" end end end
Version data entries
6 entries across 6 versions & 1 rubygems