Extract constants for column size length validation limits (#30045)
This commit is contained in:
parent
ebcf9840f4
commit
f4a53f3fb4
7 changed files with 21 additions and 7 deletions
|
@ -19,12 +19,14 @@
|
|||
class Invite < ApplicationRecord
|
||||
include Expireable
|
||||
|
||||
COMMENT_SIZE_LIMIT = 420
|
||||
|
||||
belongs_to :user, inverse_of: :invites
|
||||
has_many :users, inverse_of: :invite, dependent: nil
|
||||
|
||||
scope :available, -> { where(expires_at: nil).or(where('expires_at >= ?', Time.now.utc)) }
|
||||
|
||||
validates :comment, length: { maximum: 420 }
|
||||
validates :comment, length: { maximum: COMMENT_SIZE_LIMIT }
|
||||
|
||||
before_validation :set_code
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue