Topic: RESTful Authentication Redirects
I have a bunch of articles which are basically all teasers to the public user. Once you log in you get full access and can read the whole thing. The login form is on the same page as the article, so you can log in right on the spot.
It all works splendidly except that when a user logins in, they are redirected to the homepage, instead of the article they were trying to read.
Now, out of the box, RESTful auth is supposed to support this behavior. Browsing through the authenticated_system file in the lib folder, I see these methods
# Store the URI of the current request in the session.
# We can return to this location by calling #redirect_back_or_default.
session[:return_to] = request.request_uri
# Redirect to the URI stored by the most recent store_location call or
# to the passed default.
session[:return_to] ? redirect_to_url(session[:return_to]) : redirect_to(default)
session[:return_to] = nil
In my sessions create action I am definitely calling the method correctly
flash[:notice] = "You have logged in successfully."
But it always redirects to the homepage no matter where I am.
I tried to get clever and simply redirect to the request uri
But that bombs out with "No action responded to show", which is weird because I debug request.request_uri in my view and it clearly shows up as a string containing the relative URL, but for some reason my controller does not like this.
Any bright ideas are certainly welcome