app/controllers/application_controller.rb
def store_location(url = url_for(controller: controller_name, action: action_name))
    # 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 = 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
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
url_for
controller_name
action_name