Tuesday, May 22, 2012

Redirecting to previous URL after login - Rails

For the app that I am writing, I am using simple hand made authentication (as described on Railscast.com). Using some code from Ryan Bates' NiftyGenerators gem, I have an authentication model that has some useful methods for authentication. This module is included into application_controller.rb.



One of the methods that I want to use is called redirect_to_target_or_default. I know this is what I need to redirect a user to the page that they were on once they have authenticated but I don't know where I should call this method? If someone could give me an idea on how to use this method, I would greatly appreciate it.



ControllerAuthenticaion Module Code



enter image description here





No comments:

Post a Comment