From: Tom Hughes Date: Wed, 6 Dec 2023 20:28:40 +0000 (+0000) Subject: Add scope for unexpired user tokens X-Git-Tag: live~703^2~3 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/b42d48ff65b10ae51696e38e4fa8f969c7a3710c?ds=inline Add scope for unexpired user tokens --- diff --git a/app/models/user_token.rb b/app/models/user_token.rb index f927563a9..fbd276a6f 100644 --- a/app/models/user_token.rb +++ b/app/models/user_token.rb @@ -21,6 +21,8 @@ class UserToken < ApplicationRecord belongs_to :user + scope :unexpired, -> { where("expiry >= now()") } + after_initialize :set_defaults def expired?