]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/oauth_token.rb
Fix bug allowing created elements to reference deleted ones
[rails.git] / app / models / oauth_token.rb
index f2dd31df08a4d729c261e27377324e1461f04b9d..9a3e7de9eca142c21574f011ef33ee393f573539 100644 (file)
@@ -4,8 +4,9 @@ class OauthToken < ActiveRecord::Base
 
   scope :authorized, -> { where("authorized_at IS NOT NULL and invalidated_at IS NULL") }
 
-  validates_uniqueness_of :token
-  validates_presence_of :client_application, :token
+  validates :token, :presence => true, :uniqueness => true
+  validates :user, :associated => true
+  validates :client_application, :presence => true
 
   before_validation :generate_keys, :on => :create