class Answer < ActiveRecord::Base
  belongs_to :user
  belongs_to :question

  scope :correct, -> { where(correct: true)}
  scope :incorrect, -> { where(correct: false)}

  def answer! answers = []
    self.correct = question.are_answers_correct? answers
    save
  end
  def correct?
    correct
  end
end
