Welcome to mirror list, hosted at ThFree Co, Russian Federation.

expirable.rb « concerns « models « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b66ba08dc593945b320c7f9a7210f66d618c91f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
module Expirable
  extend ActiveSupport::Concern

  included do
    scope :expired, -> { where('expires_at <= ?', Time.current) }
  end

  def expired?
    expires? && expires_at <= Time.current
  end

  def expires?
    expires_at.present?
  end

  def expires_soon?
    expires? && expires_at < 7.days.from_now
  end
end