This does bring up an interesting point about flow control.
Even when you're not using a wizard-style intereface, there will be
times when the application needs to have a slightly more complex
behavior than a simple redirect or render. Say, a chain of redirects
that happens only when the user first signs up.
It seems ugly to embed this across several actions and controllers.
.
I've been thinking about the possibility of separating program flow
from controllers / actions. To make a kind of DSL that says, "under
these conditions, follow this path"
Have done some work on a plugin - nothing that's release-worthy though.
Even when you're not using a wizard-style intereface, there will be
times when the application needs to have a slightly more complex
behavior than a simple redirect or render. Say, a chain of redirects
that happens only when the user first signs up.
Couldn't you handle this in one controller? Place cross-controller
code in helpers?
I've been thinking about the possibility of separating program flow
from controllers / actions.
I thought controllers controlled application flow. Controllers don't
have to map to just one model. Right? (Or am I just crazy?)
You're right - for most cases controllers handel application flow just
fine. After you create a record, you'll probably want to redirect to
the list of records, etc.
But there are certain cases where you need to completely change this
up. For example: An app I'm working on has two ways you can sign up -
full and partial. The program flow looks something like this (it might
look weird here, but makes sense in context of the project):
Sure, I could add conditional redirects to each of these actions. But
things get tangled up pretty quickly.
Also, I could make a new single controller that wraps all of these
controller/action pairs. That wouldn't be a bad idea, actually. I think
the only way to do that would be to use components. Aren't those being
phased out?
Anyway, I don't have the answer to all of this - but its an interesting
problem.