Sha256: 549b8d2362e715e507bb687edb867569dad6494ffa03daf1e5b6c830c5eeef9c
Contents?: true
Size: 921 Bytes
Versions: 2
Compression:
Stored size: 921 Bytes
Contents
module Doorkeeper module AccessGrantMixin extend ActiveSupport::Concern include OAuth::Helpers include Models::Expirable include Models::Revocable include Models::Accessible include Models::Scopes included do belongs_to :application, class_name: 'Doorkeeper::Application', inverse_of: :access_grants if ::Rails.version.to_i < 4 || defined?(::ProtectedAttributes) attr_accessible :resource_owner_id, :application_id, :expires_in, :redirect_uri, :scopes end validates :resource_owner_id, :application_id, :token, :expires_in, :redirect_uri, presence: true validates :token, uniqueness: true before_validation :generate_token, on: :create end module ClassMethods def by_token(token) where(token: token).first end end private def generate_token self.token = UniqueToken.generate end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
doorkeeper-2.0.0.rc2 | lib/doorkeeper/models/access_grant_mixin.rb |
doorkeeper-2.0.0.alpha1 | lib/doorkeeper/models/access_grant_mixin.rb |