From b42d48ff65b10ae51696e38e4fa8f969c7a3710c Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Wed, 6 Dec 2023 20:28:40 +0000 Subject: [PATCH] Add scope for unexpired user tokens --- app/models/user_token.rb | 2 ++ 1 file changed, 2 insertions(+) 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? -- 2.39.5