Module: JumpBack
- Defined in:
- lib/jump_back.rb,
lib/jump_back/engine.rb,
lib/jump_back/version.rb,
lib/jump_back/redirect_back.rb,
lib/jump_back/return_to_referer.rb
Defined Under Namespace
Classes: Engine, RefererInterpreter
Constant Summary
collapse
- VERSION =
"0.0.1"
Instance Method Summary
collapse
Instance Method Details
#clear_referer ⇒ Object
10
11
12
|
# File 'lib/jump_back/return_to_referer.rb', line 10
def clear_referer
session.delete(:jump_back_stored_referer)
end
|
#redirect_back(path = root_path, options = {}) ⇒ Object
2
3
4
5
6
7
8
|
# File 'lib/jump_back/redirect_back.rb', line 2
def redirect_back(path=root_path, options={})
if path.is_a? Hash
options = path
path = root_path
end
RefererInterpreter.new.back?(request, options) ? redirect_to(:back) : redirect_to(path)
end
|
#return_to_referer(path = root_path) ⇒ Object
6
7
8
|
# File 'lib/jump_back/return_to_referer.rb', line 6
def return_to_referer(path=root_path)
session[:jump_back_stored_referer] ? redirect_to(clear_referer) : redirect_to(path)
end
|
#save_referer ⇒ Object
2
3
4
|
# File 'lib/jump_back/return_to_referer.rb', line 2
def save_referer
session[:jump_back_stored_referer] ||= request.referer
end
|