1
0
mirror of https://github.com/projekteuler/projekteuler.git synced 2026-01-27 10:38:50 +01:00

Use Omniauthable user model with admin role

This commit is contained in:
2019-02-03 18:00:42 +01:00
parent 52c8e3d7d2
commit b0f8bc5090
18 changed files with 167 additions and 39 deletions

11
app/models/user.rb Normal file
View File

@@ -0,0 +1,11 @@
class User < ApplicationRecord
devise :omniauthable, :rememberable
enum role: [:user, :admin]
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