Variables and state across forms and actions

I’d be grateful for pointers to or discussion of how and when Rails
sets variables in forms and controllers. Here is the immediate problem:

I have a form, call it Form A, which modifies the state of an
existing object and records that in the database. It sometimes wants
a new object, so there’s a link to create a new one. That link goes
to the usual form to create a new object of the appropriate kind. I’d
like it to create the object, and then return to Form A – not the
usual page shown after creation of the relevant object outside of
this process.

I’ve been trying to pass the information in params. I can get params
[:redirect] set to something when it comes time to render the form
for creation of the new object. But I can’t seem to get it to persist
long enough to be recognised by the controller that actually does the
work, and which could then redirect to either the usual page or the
unusual one.

Help? Please? As I’ve said, a general discussion of how to preserve
little bits of state across pages would be really helpful to me. I
know that I could use session variables, but it seems a big hammer
for a little problem – or is that just the only hammer there is?



John B.