class Answer < ApplicationRecord

  belongs_to :player
  belongs_to :node

  validates :value, presence: true
  validates :value, numericality: { only_integer: true, greater_than_or_equal_to: 0, less_than_or_equal_to: 1 }

  scope :ordered, -> { joins(:node).order('nodes.position ASC, nodes.ancestry ASC') }

end
