ruby on rails - cancan/devise - redirect to requested path -


when user visits page not authorized view redirected login page. after log in redirected site root. there quick , easy way redirect them page asked for?

you add hidden field referring_page sign_in-form add former referrer field , route there if existing, this:

def after_sign_in_path_for(resource)   params[:referring_page] || super end 

it's manual solution prefer using complex logic on controller side.


Comments

Popular posts from this blog

All overlapping substrings matching a java regex -

c++ - Using OpenSSL in a multi-threaded application -

php - Deleting/Renaming a locked file -