On Jan 27, 2012, at 9:45 AM, Rodrigo R. wrote:
What should I do?
I think you need to re-think how this login will work. If you’re trying
to log in on a page, and then show that same page again after the user
has logged in, what will trigger to the authentication system that the
login is necessary?
Devise is abstracted around solving this particular problem: User
arrives at a page that she needs to be authenticated in order to see.
She is redirected to a login page, authenticates, and then is redirected
back to the originally requested page. If you’re not trying to do that,
then you have to add on to that behavior, not replace it, or you won’t
have much benefit to using this framework.
Try this. Follow the examples (RailsCast has a very nice treatment of
Devise, goes into all the nooks and crannies in two parts) and build the
normal authentication system. Be sure to set a root page that is not the
login path. Then add a login form to your root page (and optionally
hide it if the user is logged in) using render partial in your view.
This will be used to authenticate people who want to sign in before
they are required to sign in.