Created
August 23, 2016 15:07
-
-
Save kaileeagray/21d073cf3e223df06fc4b0bbdfa8ce94 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| class User < ApplicationRecord | |
| validates :email, :presence => true | |
| validates :email, :uniqueness => true | |
| has_secure_password | |
| def self.find_or_create_by_omniauth(auth) | |
| oauth_email = auth["info"]["email"] || auth["info"]["nickname"] || auth["info"]["name"] | |
| self.where(:email => oauth_email).first_or_create do |user| | |
| user.password = SecureRandom.hex | |
| end | |
| end | |
| end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment