module Omniauth module Social::Callbacks def google_oauth2 signin_and_redirect end def facebook signin_and_redirect end def twitter signin_and_redirect end private def signin_and_redirect Social::Service.new(request, self).execute do |success, failure| success.call { redirect_to root_path, notice: t('.notice') } failure.call { redirect_to root_path, alert: t('.alert') } end end end end