Add uniqueness tests for Event scope on Vote model with User association
This commit is contained in:
parent
dfb159a0e1
commit
aa99f909a6
2 changed files with 25 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue