]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/oauth_token.rb
Set Open Graph image to first image for diary entries
[rails.git] / app / models / oauth_token.rb
index 5eeda48ba87ae7e13bb5ef923435f925c03bca6d..ae15dc658e73ec726bc78d989505ad34ce8fac88 100644 (file)
@@ -35,9 +35,9 @@
 #  oauth_tokens_user_id_fkey                (user_id => users.id)
 #
 
 #  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") }
 
 
   scope :authorized, -> { where("authorized_at IS NOT NULL and invalidated_at IS NULL") }
 
@@ -52,7 +52,7 @@ class OauthToken < ActiveRecord::Base
   end
 
   def invalidate!
   end
 
   def invalidate!
-    update(:invalidated_at => Time.now)
+    update(:invalidated_at => Time.now.utc)
   end
 
   def authorized?
   end
 
   def authorized?