Sha256: d9dec957fcc8cd80b977edde7a5bd378779eeb3ef903836bf9127ac5f38e315d
Contents?: true
Size: 594 Bytes
Versions: 5
Compression:
Stored size: 594 Bytes
Contents
class Answer < ActiveRecord::Base # Extending surveyor include "#{self.name}Extensions".constantize if Surveyor::Config['extend'].include?(self.name.underscore) # Associations belongs_to :question has_many :responses # Scopes default_scope :order => "display_order ASC" # Validations validates_presence_of :text validates_numericality_of :question_id, :allow_nil => false, :only_integer => true # Methods def renderer(q = question) r = [q.pick.to_s, self.response_class].compact.map(&:downcase).join("_") r.blank? ? :default : r.to_sym end end
Version data entries
5 entries across 5 versions & 3 rubygems