Fix Invite#code
changing value on every save (#33550)
This commit is contained in:
parent
34cd7d6585
commit
22c1b6f3ee
2 changed files with 46 additions and 1 deletions
|
@ -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?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue