mirror of
https://github.com/we-promise/sure.git
synced 2026-04-19 12:04:08 +00:00
Fix duplicate invites (#1437)
Co-authored-by: Josh Pigford <josh@joshpigford.com>
This commit is contained in:
@@ -5,6 +5,7 @@ class Invitation < ApplicationRecord
|
||||
validates :email, presence: true, format: { with: URI::MailTo::EMAIL_REGEXP }
|
||||
validates :role, presence: true, inclusion: { in: %w[admin member] }
|
||||
validates :token, presence: true, uniqueness: true
|
||||
validates_uniqueness_of :email, scope: :family_id, message: "has already been invited to this family"
|
||||
validate :inviter_is_admin
|
||||
|
||||
before_validation :generate_token, on: :create
|
||||
|
||||
Reference in New Issue
Block a user