Skip to content

Instantly share code, notes, and snippets.

View justinsoong's full-sized avatar

Justin Soong justinsoong

View GitHub Profile
@justinsoong
justinsoong / multiprovider.rb
Last active January 25, 2016 21:51
Multi OmniAuth Provider
class Identity < ActiveRecord::Base
belongs_to :user
validates_presence_of :uid, :provider
validates_uniqueness_of :uid, :scope => :provider
def self.find_for_oauth(auth)
find_or_create_by(uid: auth.uid, provider: auth.provider)
end
end