In my project im using omniauth-facebook(g+) gems to provide users with ability to create accoutns in 1 click. However after user signed in into facebook(g+) he's being redirected to callback url. In my case it looks like www.example.com/users/omniauth_callbacks/facebook
facebook actions looks like
def facebook
@user = User.find_by_email(ENV['omniauth'].email)
if @user
sign_in @user
redirect_to root_path
else
create_user_account(ENV['omniauth'])
end
But instead of redirect_to root_path i'd like to return user back to page where he called sign_in process. I tried to user redirect_to :back, but this throws me error with empty HTTP_REFERRER. Is there any other way to track controller and action before user start sign_in process and then store it and use after callback?