lib/doorkeeper/orm/mongoid4/application.rb in doorkeeper-mongodb-3.0.0 vs lib/doorkeeper/orm/mongoid4/application.rb in doorkeeper-mongodb-4.0.0

- old
+ new

@@ -1,25 +1,31 @@ module Doorkeeper class Application include Mongoid::Document include Mongoid::Timestamps - include Models::Mongoid4::Scopes - include ApplicationMixin + include DoorkeeperMongodb::Compatible - self.store_in collection: :oauth_applications + include DoorkeeperMongodb::Shared::Scopes + include DoorkeeperMongodb::Mixins::Mongoid::ApplicationMixin + store_in collection: :oauth_applications + field :name, type: String field :uid, type: String field :secret, type: String field :redirect_uri, type: String - index({ uid: 1 }, { unique: true }) + index({ uid: 1 }, unique: true) has_many :authorized_tokens, class_name: 'Doorkeeper::AccessToken' def self.authorized_for(resource_owner) - ids = AccessToken.where(resource_owner_id: resource_owner.id, revoked_at: nil).map(&:application_id) + ids = AccessToken.where( + resource_owner_id: resource_owner.id, + revoked_at: nil + ).map(&:application_id) + find(ids) end end end