X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/a41d500b9f65ec9f4e848effd38dc1ae117e7594..52f755cb27dd7dad2fe65a3deb5d4591c6675dec:/app/models/user_token.rb?ds=inline 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