Sha256: 310b08f9970b73e02fb9c1ed400672fe0ae80afce3659c8af7f349ab6c5e05ac
Contents?: true
Size: 516 Bytes
Versions: 5
Compression:
Stored size: 516 Bytes
Contents
class Answer < ActiveRecord::Base attr_accessible :question_id, :answer, :choice_id belongs_to :answerer, :polymorphic => true belongs_to :question belongs_to :choice validates_presence_of :question_id default_scope joins(:question).order('questions.position') scope :for_answerer, lambda{|answerer| where(:answerer_type => answerer.class.to_s, :answerer_id => answerer.id)} scope :for_question, lambda{|question| where(:question_id => question.id)} def to_s self.answer.to_s end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
ask-0.4.1 | app/models/answer.rb |
ask-0.4.0 | app/models/answer.rb |
ask-0.3.1 | app/models/answer.rb |
ask-0.3.0 | app/models/answer.rb |
ask-0.2.0 | app/models/answer.rb |