The code powering m.abunchtell.com https://m.abunchtell.com
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

23 行
640 B

  1. # frozen_string_literal: true
  2. # == Schema Information
  3. #
  4. # Table name: identities
  5. #
  6. # provider :string default(""), not null
  7. # uid :string default(""), not null
  8. # created_at :datetime not null
  9. # updated_at :datetime not null
  10. # id :bigint(8) not null, primary key
  11. # user_id :bigint(8)
  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