Created
August 23, 2016 15:07
-
-
Save kaileeagray/21d073cf3e223df06fc4b0bbdfa8ce94 to your computer and use it in GitHub Desktop.
Revisions
-
kaileeagray created this gist
Aug 23, 2016 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ 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