The code powering m.abunchtell.com https://m.abunchtell.com
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 
 

23 Zeilen
638 B

  1. # frozen_string_literal: true
  2. # == Schema Information
  3. #
  4. # Table name: identities
  5. #
  6. # id :integer not null, primary key
  7. # user_id :integer
  8. # provider :string default(""), not null
  9. # uid :string default(""), not null
  10. # created_at :datetime not null
  11. # updated_at :datetime not null
  12. #
  13. class Identity < ApplicationRecord
  14. belongs_to :user, dependent: :destroy
  15. validates :uid, presence: true, uniqueness: { scope: :provider }
  16. validates :provider, presence: true
  17. def self.find_for_oauth(auth)
  18. find_or_create_by(uid: auth.uid, provider: auth.provider)
  19. end
  20. end