0
0
Fork 0

Fix Invite#code changing value on every save (#33550)

This commit is contained in:
Matt Jankowski 2025-01-10 15:34:18 -05:00 committed by GitHub
parent 34cd7d6585
commit 22c1b6f3ee
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 46 additions and 1 deletions

View file

@ -31,7 +31,7 @@ class Invite < ApplicationRecord
validates :comment, length: { maximum: COMMENT_SIZE_LIMIT }
before_validation :set_code
before_validation :set_code, on: :create
def valid_for_use?
(max_uses.nil? || uses < max_uses) && !expired? && user&.functional?