X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/ef7f3d800cbdd49b692df10d312e5fd880e2e938..26210d639cd94567edc4ce77e9994fce758c8037:/app/models/oauth_token.rb?ds=sidebyside diff --git a/app/models/oauth_token.rb b/app/models/oauth_token.rb index f2dd31df0..9a3e7de9e 100644 --- a/app/models/oauth_token.rb +++ b/app/models/oauth_token.rb @@ -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