Class: Otto::ResponseHandlers::RedirectHandler
- Inherits:
-
BaseHandler
- Object
- BaseHandler
- Otto::ResponseHandlers::RedirectHandler
- Defined in:
- lib/otto/response_handlers.rb
Overview
Handler for redirect responses
Class Method Summary collapse
Class Method Details
.handle(result, response, context = {}) ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/otto/response_handlers.rb', line 41 def self.handle(result, response, context = {}) # Determine redirect path path = if context[:redirect_path] context[:redirect_path] elsif context[:logic_instance]&.respond_to?(:redirect_path) context[:logic_instance].redirect_path elsif result.is_a?(String) result else '/' end response.redirect(path) end |