Sha256: 8595f59f6eafaf5532bbea438066689402ab216d218681327f460d9536c19ad9
Contents?: true
Size: 462 Bytes
Versions: 12
Compression:
Stored size: 462 Bytes
Contents
class Answer < ActiveRecord::Base # 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
12 entries across 12 versions & 1 rubygems