Guest User

Untitled

a guest
Apr 26th, 2016
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. class User < ActiveRecord::Base
  2. has_many :submissions
  3.  
  4. def self.sign_in_from_omniauth(auth)
  5. find_by(provider: auth['provider'], uid: auth['uid']) || create_user_from_omniauth(auth)
  6. end
  7.  
  8. def self.create_user_from_omniauth(auth)
  9. create(
  10. provider: auth['provider'],
  11. uid: auth['uid'],
  12. name: auth['info']['name'],
  13. about: auth['info']['description'],
  14. email: auth['info']['email']
  15. )
  16. end
  17. end
Advertisement
Add Comment
Please, Sign In to add comment