Sha256: 82880826d3fc5ace5641b37488a5223a28b87655542466a94b202c697814c9f8

Contents?: true

Size: 636 Bytes

Versions: 3

Compression:

Stored size: 636 Bytes

Contents

class Identity < ActiveRecord::Base
  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           not null
#

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
enju_seed-0.4.0.beta.1 app/models/identity.rb
enju_seed-0.3.0.beta.4 app/models/identity.rb
enju_seed-0.3.0.beta.3 app/models/identity.rb