diff options
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/score.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/app/models/score.rb b/app/models/score.rb index 5147ce0..ccc795f 100644 --- a/app/models/score.rb +++ b/app/models/score.rb @@ -3,4 +3,9 @@ class Score < ApplicationRecord 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 |