X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/e731dd71a77ad4ad1e9db22535e89444bb98e5d9..df4349a0505fd0acc6dab814efba9113af24dba5:/app/models/oauth_token.rb diff --git a/app/models/oauth_token.rb b/app/models/oauth_token.rb index 5eeda48ba..ae15dc658 100644 --- a/app/models/oauth_token.rb +++ b/app/models/oauth_token.rb @@ -35,9 +35,9 @@ # oauth_tokens_user_id_fkey (user_id => users.id) # -class OauthToken < ActiveRecord::Base - belongs_to :client_application - belongs_to :user +class OauthToken < ApplicationRecord + belongs_to :client_application, :optional => true + belongs_to :user, :optional => true scope :authorized, -> { where("authorized_at IS NOT NULL and invalidated_at IS NULL") } @@ -52,7 +52,7 @@ class OauthToken < ActiveRecord::Base end def invalidate! - update(:invalidated_at => Time.now) + update(:invalidated_at => Time.now.utc) end def authorized?