Created
October 15, 2017 16:53
-
-
Save negabaro/4d632ba260449cf6e69c0e961be1ec37 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#app/models/user.rb | |
def self.find_for_twitter_oauth(auth, signed_in_resource=nil) | |
user = User.where(:provider => auth.provider, :uid => auth.uid).first | |
unless user | |
user = User.create(user_nickname: auth.info.nickname, | |
provider: auth.provider, | |
uid: auth.uid, | |
email: User.create_unique_email, | |
password: Devise.friendly_token[0,20] | |
) | |
end | |
user | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment