class Score < ApplicationRecord belongs_to :tartiflette belongs_to :scoring_criterium validates :value, presence: true, inclusion: { in: 1..5 } validates :session_id, presence: true validates :tartiflette_id, uniqueness: { scope: [:scoring_criterium_id, :session_id], message: "has already been scored for this session and criterium." } end