views:

99

answers:

1

I have a page flow allowing the user to choose an object ("Player") to add to a has_many :players association in another model.

 1 => List existing players for object [Enter player name] 
 2 => List of matching players [Select player] 
 3 => Confirmation page [Press 'Add']
 4 => Done

I want users to be able to choose "New Player" instead of selecting a player at step 2, in which case the user will go through the standard New Player process elsewhere on the site.

However, after that's done, the user should return to step 3 with the new player in place.

I don't know what the best way is to implement this. I don't want to duplicate the player creation code, but I don't want to dirty up the player creation code too much just for this case.

I also don't want to start sticking IDs in the session if I can help it. It's fine in simple cases but if the user ever has two windows/tabs then things start behaving badly.

What do you think?

A: 

My practice, may it be good or not, is to send a return-to-path with the new_player form and, well, redirect to that step three after creating the player.

Thomas R. Koll