mirror of
https://github.com/Retrospring/retrospring.git
synced 2025-01-18 13:45:59 +01:00
Add uniqueness validation to Reactions
This commit is contained in:
parent
8cdc0b28d3
commit
536d50f53d
1 changed files with 2 additions and 0 deletions
|
@ -4,6 +4,8 @@ class Reaction < ApplicationRecord
|
|||
belongs_to :parent, polymorphic: true
|
||||
belongs_to :user
|
||||
|
||||
validates_uniqueness_of :parent_id, :scope => :user_id
|
||||
|
||||
# rubocop:disable Rails/SkipsModelValidations
|
||||
after_create do
|
||||
Notification.notify parent.user, self unless parent.user == user
|
||||
|
|
Loading…
Reference in a new issue