Sha256: 8a03e5de7a71bc30b71231b7d17cb7ee161f4126534febbe93a2e39f2d8218cc
Contents?: true
Size: 930 Bytes
Versions: 1
Compression:
Stored size: 930 Bytes
Contents
module Doorkeeper class Application include Doorkeeper::OAuth::Helpers has_many :access_grants, :dependent => :destroy, :class_name => "Doorkeeper::AccessGrant" has_many :access_tokens, :dependent => :destroy, :class_name => "Doorkeeper::AccessToken" validates :name, :secret, :uid, :redirect_uri, :presence => true validates :uid, :uniqueness => true validates :redirect_uri, :redirect_uri => true before_validation :generate_uid, :generate_secret, :on => :create def self.model_name ActiveModel::Name.new(self, Doorkeeper, 'Application') end def self.authenticate(uid, secret) self.where(:uid => uid, :secret => secret).first end def self.by_uid(uid) self.where(:uid => uid).first end private def generate_uid self.uid = UniqueToken.generate end def generate_secret self.secret = UniqueToken.generate end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
doorkeeper-0.7.0 | lib/doorkeeper/models/application.rb |