I don't know if I'm thinking the right way or not.
In my rails app, I use facebook authentication with Omniauth.
I have 2 different links "Sign In" (both of them target to auth/facebook with callback authentications/create). One should redirect to the user profile (users/show) and the other one to a post creation (posts/new).
I think a good way to do that is to store the path (users/show) or (posts/new) when the user is clicking on one of the "sign in" links, and then redirect to this path on authentications/create method. I thought about before_filter on "auth/facebook".
But auth/facebook is an external link to facebook and not a regular action. So how can I do that ?
I might try storing a "final_destination" variable in the session in auth/facebook.
session[:final_destination] = params[:final_destination]
...
omniauth_does_its_thing
...
You would have to store it in a variable because authentications/create is probably going use the session to log you in.
final_destination = session[:final_destination]
After the end of the created action:
redirect_to final_destination
or
redirect_to final_destination_2 if sequels.enjoy?