Displaying 1 result from an estimated 1 matches for "cannot_be_true_and_fifty_fifty".
2009 Oct 27
5
Unwanted call to validates_associated
...t; :millionaire_question
belongs_to :question, :class_name => "MillionaireQuestion"
named_scope :correct, :conditions => ["correct = ?", true]
named_scope :fifty_fifty, :conditions => ["fifty_fifty = ?", true]
validates_presence_of :text
validate :cannot_be_true_and_fifty_fifty
def letter
self.position ? %w(x A B C D)[self.position] : nil
end
def cannot_be_true_and_fifty_fifty
errors.add_to_base("Answer is marked as the correct answer and the
fifty-fifty answer") if self.correct && self.fifty_fifty
end
end
--
Posted via http://www.ruby...