Sha256: 44eaf13a43f39ffaa62089605ba307def7a2d6caf8f1d65a276abcd50828b079

Contents?: true

Size: 614 Bytes

Versions: 4

Compression:

Stored size: 614 Bytes

Contents

class Identity < ApplicationRecord
  belongs_to :profile
  validates :name, presence: true, uniqueness: {scope: :provider}
  validates :provider, presence: true

  def self.find_for_oauth(auth)
    where(name: auth.uid, provider: auth.provider).first_or_create
  end
end

# == Schema Information
#
# Table name: identities
#
#  id              :integer          not null, primary key
#  name            :string
#  email           :string
#  password_digest :string
#  profile_id      :integer
#  created_at      :datetime         not null
#  updated_at      :datetime         not null
#  provider        :string
#

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
enju_seed-0.3.6 app/models/identity.rb
enju_seed-0.3.5 app/models/identity.rb
enju_seed-0.3.4 app/models/identity.rb
enju_seed-0.3.3 app/models/identity.rb