Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class User < ActiveRecord::Base
- has_many :submissions
- def self.sign_in_from_omniauth(auth)
- find_by(provider: auth['provider'], uid: auth['uid']) || create_user_from_omniauth(auth)
- end
- def self.create_user_from_omniauth(auth)
- create(
- provider: auth['provider'],
- uid: auth['uid'],
- name: auth['info']['name'],
- about: auth['info']['description'],
- email: auth['info']['email']
- )
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment