]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/user_token.rb
Don't show unredacted element versions to non-moderators
[rails.git] / app / models / user_token.rb
index 844357d8d0242000db462047ea6be54bd01342c1..fbd276a6f32d3c70cef8b4ead629e4a377369722 100644 (file)
 #  user_tokens_user_id_fkey  (user_id => users.id)
 #
 
-class UserToken < ActiveRecord::Base
+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