gitlab-org--gitlab-foss/app/models/concerns/expirable.rb
2016-08-18 22:45:41 +01:00

15 lines
246 B
Ruby

module Expirable
extend ActiveSupport::Concern
included do
scope :expired, -> { where('expires_at <= ?', Time.current) }
end
def expires?
expires_at.present?
end
def expires_soon?
expires_at < 7.days.from_now
end
end