Class: User

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/user.rb

Class Method Summary collapse

Class Method Details

.create_with_omniauth(auth) ⇒ Object



2
3
4
5
6
7
8
9
# File 'app/models/user.rb', line 2

def self.create_with_omniauth(auth)
  where(email: auth['info']['email']).first_or_initialize.tap do |user|
    user.provider = auth['provider']
    user.uid = auth['uid']
    user.name = auth['info']['name'] || ''
    user.save!
  end
end