]> git.openstreetmap.org Git - rails.git/commitdiff
Add scope for unexpired user tokens
authorTom Hughes <tom@compton.nu>
Wed, 6 Dec 2023 20:28:40 +0000 (20:28 +0000)
committerTom Hughes <tom@compton.nu>
Sat, 24 Feb 2024 13:20:07 +0000 (13:20 +0000)
app/models/user_token.rb

index f927563a948694b80197a2cdf1523f9f9ec126e4..fbd276a6f32d3c70cef8b4ead629e4a377369722 100644 (file)
@@ -21,6 +21,8 @@
 class UserToken < ApplicationRecord
   belongs_to :user
 
+  scope :unexpired, -> { where("expiry >= now()") }
+
   after_initialize :set_defaults
 
   def expired?