X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/11cc4a5e601dd288d601e6e35a72d159062f18b5..f816482778fad28424a4b2a151e0ba8ede2dcd97:/app/models/user_token.rb diff --git a/app/models/user_token.rb b/app/models/user_token.rb index 844357d8d..fbd276a6f 100644 --- a/app/models/user_token.rb +++ b/app/models/user_token.rb @@ -18,13 +18,15 @@ # 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