]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/user_token.rb
Merge pull request #4534 from tomhughes/list-headers
[rails.git] / app / models / user_token.rb
index 8c9bf4aeb36de68479d11533e406f9106877da4b..fbd276a6f32d3c70cef8b4ead629e4a377369722 100644 (file)
 class UserToken < ApplicationRecord
   belongs_to :user
 
+  scope :unexpired, -> { where("expiry >= now()") }
+
   after_initialize :set_defaults
 
   def expired?
-    expiry < Time.now
+    expiry < Time.now.utc
   end
 
   private