personalized rooms page

This commit is contained in:
Zachary Chai
2016-10-18 13:51:05 -04:00
parent 14ad57d4d1
commit 8693ba5860
8 changed files with 54 additions and 2 deletions

View File

@ -2,8 +2,13 @@ class User < ApplicationRecord
def self.from_omniauth(auth_hash)
user = find_or_create_by(uid: auth_hash['uid'], provider: auth_hash['provider'])
user.username = self.send("#{auth_hash['provider']}_username", auth_hash) rescue nil
user.name = auth_hash['info']['name']
user.save!
user
end
def self.twitter_username(auth_hash)
auth_hash['info']['nickname']
end
end