How to redirect by checking for a particular previous url
- by Bearish_Boring_dude
I have the following piece of code in my controller
def index
session[:previous_url] = URI(request.referer).path
if session[:previous_uri] != new_path
redirect_to registration_path(id: current_user.associate_username)
end
end
However this does not actually work and i get a bad URI error.
I just want to check if the request came from a particular page and if not redirect it to another page. I would also like to know if there is a better way for doing this?.Thank you