Skip to content

Instantly share code, notes, and snippets.

@epoch
Created March 4, 2014 10:10
Show Gist options
  • Save epoch/9343690 to your computer and use it in GitHub Desktop.
Save epoch/9343690 to your computer and use it in GitHub Desktop.
module ClassMethods
def find_for_oauth(auth)
record = where(provider: auth.provider, uid: auth.uid.to_s).first
record || create(provider: auth.provider, uid: auth.uid, email: auth.info.email, password: Devise.friendly_token[0,20])
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment