X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/461f99dfe03ed0dfea2d973378e0ace70134c199..ee4c34172f0a0145344525962cc5411a7f260ff5:/app/models/user_token.rb diff --git a/app/models/user_token.rb b/app/models/user_token.rb index 8c9bf4aeb..fbd276a6f 100644 --- a/app/models/user_token.rb +++ b/app/models/user_token.rb @@ -21,10 +21,12 @@ 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