app/controllers/application_controller.rb
# store a given URL (defaults to current) in case we need to redirect back later
store a given URL (defaults to current) in case we need to redirect back later
store a given URL ( defaults to current ) in case we need to redirect back later
def store_location(url = url_for(controller: controller_name, action: action_name))
    url = nil unless url =~ /\A([%2F\/]|#{root_url})/
    session[:return_to] = url
  end
def store_location ( url = url_for ( controller : controller_name , action : action_name ) ) url = nil unless url =~ / \A ([%2F \/ ]| #{ root_url } ) / session [ :return_to ] = url end
store a given URL (defaults to current) in case we need to redirect back later
store a given URL ( defaults to current ) in case we need to redirect back later
# It's possible to create a redirection attack with a redirect to data: protocol... and possibly others, so: # Whitelisting redirection to our own site and relative paths.
url
<not_specific>
url_for
<not_specific>
controller_name
<not_specific>
action_name
<not_specific>