I have the authentication through omniauth and that link is available on every page through layout/application.html.haml.
However, when they complete the omniauth authentication, they all go to root.
How can I set it up so they redirect to the actual page from which they clicked on the authentication link (which takes them to the oauth provider).
Thanks
You can use request.env['omniauth.origin']
.
See https://github.com/intridea/omniauth/wiki/Saving-User-Location
I see two options here:
1) Set a session variable on every page you could possibly sign in through like that:
session[:return_to] = request.fullpath
and redirect back to it after signing in:
redirect_to session[:return_to]
or
2) try
redirect_to :back
This depends on how you link your controller actions (haven't worked with omniauth, so I have no experience in that respect)