|
|
@ -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? |
|
|
|