Skip to content

Instantly share code, notes, and snippets.

@thesp0nge
Created October 19, 2010 10:08
Show Gist options
  • Save thesp0nge/633958 to your computer and use it in GitHub Desktop.
Save thesp0nge/633958 to your computer and use it in GitHub Desktop.
authentication#create method for pernataleiovorrei.com (buggy version)
def create
omniauth = request.env["omniauth.auth"]
authentication = Authentication.find_by_provider_and_uid(omniauth['provider'], omniauth['uid'])
if authentication
sign_in_and_redirect(:user, authentication.user)
else
current_user.authentications.create(:provider=>omniauth['provider'], :uid=>omniauth['uid'])
flash[:notice] = "You rock man"
redirect_to authentications_url
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment