Add uniqueness tests for Event scope on Vote model with User association

This commit is contained in:
Tymm Schmitke 2020-05-19 22:24:37 -04:00
parent dfb159a0e1
commit aa99f909a6
2 changed files with 25 additions and 0 deletions

View file

@ -4,6 +4,8 @@ class Vote < ApplicationRecord
belongs_to :user
belongs_to :event
validates :user_id, uniqueness: { scope: :event_id }
has_paper_trail ignore: [:updated_at], meta: { conference_id: :conference_id }
delegate :name, to: :user