Sha256: 71c03abca1cd9fc232b55fee826902ed7b1fffd6ad12f30a20572e59a9d14b74

Contents?: true

Size: 371 Bytes

Versions: 3

Compression:

Stored size: 371 Bytes

Contents

class Identity < ActiveRecord::Base
	belongs_to :user
	validates_presence_of :user_id, :uid, :provider
	validates_uniqueness_of :uid, :scope => :provider

	def self.find_for_oauth(auth)
	  identity = find_by(provider: auth.provider, uid: auth.uid)
	  identity = create(uid: auth.uid, provider: auth.provider) if identity.nil?
	  identity
	end # self.find_for_oauth
	
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
omniauth-infinum-0.11.1 examples/omniauth_infinum_with_facebook/app/models/identity.rb
omniauth-infinum-0.10.0 examples/omniauth_infinum_with_facebook/app/models/identity.rb
omniauth-infinum-0.10.1 examples/omniauth_infinum_with_facebook/app/models/identity.rb