Module: Mumuki::Laboratory::Controllers::ActionRedirector
- Included in:
- ApplicationController
- Defined in:
- lib/mumuki/laboratory/controllers/action_redirector.rb
Instance Method Summary collapse
- #redirect_after!(action, fallback_location: root_path) ⇒ Object
- #save_location_before!(action) ⇒ Object
Instance Method Details
#redirect_after!(action, fallback_location: root_path) ⇒ Object
6 7 8 9 10 |
# File 'lib/mumuki/laboratory/controllers/action_redirector.rb', line 6 def redirect_after!(action, fallback_location: root_path) redirection_variable = redirection_variable_for(action) destination = session.delete(redirection_variable).presence redirect_to(destination || fallback_location) end |
#save_location_before!(action) ⇒ Object
2 3 4 |
# File 'lib/mumuki/laboratory/controllers/action_redirector.rb', line 2 def save_location_before!(action) session[redirection_variable_for(action)] = origin end |