]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/oauth_token.rb
Merge branch 'pull/3472'
[rails.git] / app / models / oauth_token.rb
index affdcdeb815b45b3c6d6ad32bf9c6526064ee45b..ae15dc658e73ec726bc78d989505ad34ce8fac88 100644 (file)
@@ -36,8 +36,8 @@
 #
 
 class OauthToken < ApplicationRecord
-  belongs_to :client_application
-  belongs_to :user
+  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 < ApplicationRecord
   end
 
   def invalidate!
-    update(:invalidated_at => Time.now)
+    update(:invalidated_at => Time.now.utc)
   end
 
   def authorized?