mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-25 08:09:38 +02:00
Fix duplicate invites (#1437)
Co-authored-by: Josh Pigford <josh@joshpigford.com>
This commit is contained in:
parent
a113d573d6
commit
b3ef995d1f
3 changed files with 8 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue