Module: JumpBack::Redirection
- Defined in:
- lib/jump_back/redirect_back.rb,
lib/jump_back/return_to_referer.rb
Instance Method Summary collapse
- #clear_referer ⇒ Object
- #redirect_back(path = root_path, options = {}) ⇒ Object
- #return_to_referer(path = root_path, options = {}) ⇒ Object
- #save_referer ⇒ Object
Instance Method Details
#clear_referer ⇒ Object
16 17 18 |
# 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 = {}) ⇒ Object
5 6 7 8 |
# File 'lib/jump_back/redirect_back.rb', line 5 def redirect_back(path=root_path, ={}) = OptionsParser.new(path: path, options: , default: root_path) redirect_to PathFinder.new(request, .path, .).path, . end |
#return_to_referer(path = root_path, options = {}) ⇒ Object
11 12 13 14 |
# File 'lib/jump_back/return_to_referer.rb', line 11 def return_to_referer(path=root_path, ={}) = OptionsParser.new(path: path, options: , default: root_path) session[:jump_back_stored_referer] ? redirect_to(clear_referer, .) : redirect_to(.path, .) end |
#save_referer ⇒ Object
7 8 9 |
# File 'lib/jump_back/return_to_referer.rb', line 7 def save_referer session[:jump_back_stored_referer] ||= request.referer end |