Next page after log in

Hi, I have a best practice question:

In my web apps you have to log in to show a certain Item, but you can show the item's list without log in.

Here are the steps: Items list page -> click on certain Item -> show "log in" page -> show Item's page

How can I do to store the "next_page" information ?

whith flash[:next_page] I had some problem (because of reload current page)

Any suggest ?

thank you, Alessandro

If you're using restful_authentication plugin, check out the method called redirect_back_or_default. Even otherwise, I think thats what you want. Its a simple short method, try getting your hands on it.

Hi,

You can store this information in the session, and then in your login action you should check if session[:next_page] is present, redirect user to that page; else to normal home page.