Skip to content

Commit

Permalink
Keep scope
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Chebotarov committed Nov 8, 2024
1 parent 92d8d79 commit 0b107a3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/models/api_key.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ class ApiKey < ApplicationRecord
validates :value, uniqueness: true
validates :value, presence: true, on: :update

default_scope { where('expires_at IS NULL OR expires_at > ?', Time.current) }
default_scope { active }

scope :active, -> { where('expires_at IS NULL OR expires_at > ?', Time.current) }

private

Expand Down

0 comments on commit 0b107a3

Please sign in to comment.