Module: Adva::Responder::Redirect
- Included in:
- Base
- Defined in:
- lib/adva/responder/redirect.rb
Instance Method Summary collapse
- #controller_action_path ⇒ Object
- #current_redirect ⇒ Object
- #registry_redirect ⇒ Object
- #return_to_redirect ⇒ Object
- #to_html ⇒ Object
Instance Method Details
#controller_action_path ⇒ Object
26 27 28 |
# File 'lib/adva/responder/redirect.rb', line 26 def controller_action_path "#{controller_path}##{params[:action]}" end |
#current_redirect ⇒ Object
21 22 23 24 |
# File 'lib/adva/responder/redirect.rb', line 21 def current_redirect target = Registry.get(:redirect, controller_action_path) target.respond_to?(:call) ? target.call(controller) : target end |
#registry_redirect ⇒ Object
15 16 17 18 19 |
# File 'lib/adva/responder/redirect.rb', line 15 def registry_redirect if !has_errors? && target = current_redirect redirect_to(target) end end |
#return_to_redirect ⇒ Object
11 12 13 |
# File 'lib/adva/responder/redirect.rb', line 11 def return_to_redirect redirect_to(params[:return_to]) if !get? && params[:return_to] && !has_errors? end |
#to_html ⇒ Object
7 8 9 |
# File 'lib/adva/responder/redirect.rb', line 7 def to_html return_to_redirect || registry_redirect || super end |