module JumpBack::Redirection

Public Instance Methods

clear_referer() click to toggle source
# File lib/jump_back/return_to_referer.rb, line 16
def clear_referer
  session.delete(:jump_back_stored_referer)
end
redirect_back(path=root_path, options={}) click to toggle source
# File lib/jump_back/redirect_back.rb, line 5
def redirect_back(path=root_path, options={})
  options = OptionsParser.new(path: path, options: options, default: root_path)
  redirect_to PathFinder.new(request, options.path, options.jump_back_options).path, options.redirect_options
end
return_to_referer(path=root_path, options={}) click to toggle source
# File lib/jump_back/return_to_referer.rb, line 11
def return_to_referer(path=root_path, options={})
  options = OptionsParser.new(path: path, options: options, default: root_path)
  session[:jump_back_stored_referer] ? redirect_to(clear_referer, options.redirect_options) : redirect_to(options.path, options.redirect_options)
end
save_referer() click to toggle source
# File lib/jump_back/return_to_referer.rb, line 7
def save_referer
  session[:jump_back_stored_referer] ||= request.referer
end