ActionSegue
Allows you to create simple flows between controllers and actions which you can then complete or resume.
To begin with, you can register the beginning of a segue in a controller:
class MyController < ApplicationController
register_segue action: :index, as: :looking_at_index
def index
...
end
end
Then, at any point in the future, you can return to this segue start point. You must also pass in a fallback location which is used in the event no segue with the id is in progress.
redirect_to complete_segue_url(:looking_at_index, fallback: dashboard_path)
If you just want to clear a segue to remove it from the stack, you can use clear_segue
:
clear_segue :looking_at_index
If you don't know (or care) what current segue is in progress (useful in situations where many actions could lead away from their flow, and you just want to return to the original flow), you can just complete the current segue. This also requires a fallback location in case there is no current segue in progress.
redirect_to complete_current_segue_url(fallback: dashboard_path)
TODO
- Make it possible to use something other than the session to store segue info