hpham17/esential-2016

View on GitHub
app/models/identity.rb

Summary

Maintainability
A
0 mins
Test Coverage
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