Module: ActsAsDailycred::SingletonMethods

Defined in:
lib/dailycred/acts_as_dailycred.rb

Instance Method Summary collapse

Instance Method Details

#find_or_create_from_local_auth(user) ⇒ Object



19
20
21
22
23
# File 'lib/dailycred/acts_as_dailycred.rb', line 19

def find_or_create_from_local_auth(user)
  @user = User.find_or_create_by(provider: "dailycred", uid: user["id"])
  @user.update_from_dailycred(user)
  @user
end

#find_or_create_with_omniauth(model) ⇒ Object



13
14
15
16
17
# File 'lib/dailycred/acts_as_dailycred.rb', line 13

def find_or_create_with_omniauth(model)
  @user = User.find_by_provider_and_uid(model['provider'], model['uid']) || User.new
  @user.update_from_dailycred model[:info]
  @user
end