debian-mirror-gitlab/app/models/concerns/expirable.rb

16 lines
246 B
Ruby
Raw Normal View History

2016-09-13 17:45:13 +05:30
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