mirror of
https://github.com/projekteuler/projekteuler.git
synced 2025-12-10 08:46:41 +01:00
13 lines
325 B
Ruby
13 lines
325 B
Ruby
class User < ApplicationRecord
|
|
devise :omniauthable, :rememberable
|
|
|
|
enum role: [:user, :admin]
|
|
has_many :translations, inverse_of: :author, dependent: :nullify
|
|
|
|
def self.from_omniauth(auth)
|
|
where(provider: auth.provider, uid: auth.uid).first_or_create do |user|
|
|
user.name = auth.info.name
|
|
end
|
|
end
|
|
end
|