Class: Identity

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

Overview

Identity represents an user's OAuth identity

Class Method Summary collapse

Class Method Details

.find_or_create_with_oauth(auth) ⇒ Object


9
10
11
12
13
# File 'app/models/identity.rb', line 9

def self.find_or_create_with_oauth(auth)
  find_or_create_by(uid: auth.uid, provider: auth.provider) do |identity|
    identity.user = User.find_by(email: auth.info.email)
  end
end