Skip to content

Instantly share code, notes, and snippets.

@ckuwanoe
Created May 6, 2015 23:53
Show Gist options
  • Save ckuwanoe/4cbf48974b05a459ab12 to your computer and use it in GitHub Desktop.
Save ckuwanoe/4cbf48974b05a459ab12 to your computer and use it in GitHub Desktop.
def self.from_omniauth(auth, ref)
where(provider: auth.provider, uid: auth.uid).first_or_create do |user|
user.email = "#{auth.info.nickname}@twitter.com"
user.password = Devise.friendly_token[0,20]
user.username = auth.info.nickname # assuming the user model has a name
user.referrer_token = ref.to_s
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment