0
0
Fork 0

Add invite comments (#10465)

This commit is contained in:
ThibG 2019-08-19 11:40:42 +02:00 committed by Eugen Rochko
parent 9b6a5ed109
commit cb62a83a71
7 changed files with 17 additions and 1 deletions

View file

@ -12,6 +12,7 @@
# created_at :datetime not null
# updated_at :datetime not null
# autofollow :boolean default(FALSE), not null
# comment :text
#
class Invite < ApplicationRecord
@ -22,6 +23,8 @@ class Invite < ApplicationRecord
scope :available, -> { where(expires_at: nil).or(where('expires_at >= ?', Time.now.utc)) }
validates :comment, length: { maximum: 420 }
before_validation :set_code
def valid_for_use?