Module: Mongoid::Xoauth

Extended by:
ActiveSupport::Concern
Defined in:
lib/mongoid/xoauth.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#find_by_oauth_uid(uid, klass) ⇒ Object



17
18
19
# File 'lib/mongoid/xoauth.rb', line 17

def find_by_oauth_uid(uid, klass)
  where('oauths.uid' => uid.to_s, 'oauths._type' => klass.to_s).first
end

#oauth(klass) ⇒ Object



21
22
23
# File 'lib/mongoid/xoauth.rb', line 21

def oauth(klass)
  self.oauths.find_by(_type: klass.to_s) # "Oauth::#{name.to_s.capitalize}"
end