access_grant_extension.rb 323 B

12345678910
  1. # frozen_string_literal: true
  2. module AccessGrantExtension
  3. extend ActiveSupport::Concern
  4. included do
  5. scope :expired, -> { where.not(expires_in: nil).where('created_at + MAKE_INTERVAL(secs => expires_in) < NOW()') }
  6. scope :revoked, -> { where.not(revoked_at: nil).where(revoked_at: ...Time.now.utc) }
  7. end
  8. end