Sha256: 4c65bb550d0ce2cad994d8999f2e4dfb7146550e65dbe2903b10bb1d4fbbc277
Contents?: true
Size: 653 Bytes
Versions: 16
Compression:
Stored size: 653 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.accesstoken = auth.credentials.token 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 || "").to_json identity.save identity end end
Version data entries
16 entries across 16 versions & 1 rubygems