Sha256: dd0b4ee180bec53c776017eac45642aa7a680435642d9d794584178c2c627526
Contents?: true
Size: 587 Bytes
Versions: 1
Compression:
Stored size: 587 Bytes
Contents
class Identity < ActiveRecord::Base belongs_to :user validates_presence_of :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.name = auth.info.name identity.email = auth.info.email identity.nickname = auth.info.nickname identity.image = auth.info.image identity.phone = auth.info.phone identity.urls = auth.info.urls identity.save identity end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
happy_seed-0.0.3 | lib/generators/happy_seed/omniauth/templates/app/models/identity.rb |