ArturT/Railstom

View on GitHub
app/models/authentication.rb

Summary

Maintainability
A
0 mins
Test Coverage
class Authentication < ActiveRecord::Base
  belongs_to :user

  validates :provider, :uid, presence: true

  def self.find_with_omniauth(auth)
    find_by_provider_and_uid(auth['provider'], auth['uid'].to_s)
  end

  def self.build_with_omniauth(auth)
    new(provider: auth['provider'], uid: auth['uid'].to_s)
  end
end