Sha256: 5eb2ee1671b1eedc50ce4f9afd8097d7f96bd4fe7680508343976b59f364cd7c

Contents?: true

Size: 451 Bytes

Versions: 3

Compression:

Stored size: 451 Bytes

Contents

class User < ActiveRecord::Base
	def self.new_from_omniauth(omniauth)
		user = self.find_by_uid(omniauth['uid']) || self.find_by_email(omniauth[:extra][:email]) || self.new(:uid => omniauth['uid'])
		user.uid = omniauth['uid']
		user.first_name = omniauth['extra']['first_name']
		user.last_name = omniauth['extra']['last_name']
		user.email = omniauth['extra']['email']
		user.avatar_url = omniauth['extra']['avatar_url']
		user.save
		user
	end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
omniauth-infinum-0.11.1 examples/omniauth_infinum_standalone/app/models/user.rb
omniauth-infinum-0.10.0 examples/omniauth_infinum_standalone/app/models/user.rb
omniauth-infinum-0.10.1 examples/omniauth_infinum_standalone/app/models/user.rb