Paradigm for creating an object over several form screens?


#1

What’s the best way to create and edit an object over several form
screens before submitting it to the db?

I have an ‘edit_story’ form page, which has buttons for ‘add picture’
and ‘add_movie’. If the user selects either of these, they go to a
different screen to select and set properties for the movie or picture
they’re uploading. Then they go back to the edit_story page, which
should of course remember everything they’ve done so far. Once they’ve
done all their editing and movie/picture adding, they hit ‘submit’ on
the ‘edit_story’ page and the data is saved to the DB.

What’s the standard way of achieving this? Is it to pass a partially
constructed object around between the various screens, re-filling the
fields with its properties each time? Or to build the object up in the
db and then delete it if the user doesn’t submit? Or something more
elegant in the controller? or something else?

any advice welcome - thanks!


#2

On Jul 31, 5:15 am, Max W. removed_email_address@domain.invalid
wrote:

What’s the standard way of achieving this? Is it to pass a partially
constructed object around between the various screens, re-filling the
fields with its properties each time? Or to build the object up in the
db and then delete it if the user doesn’t submit? Or something more
elegant in the controller? or something else?

any advice welcome - thanks!

Posted viahttp://www.ruby-forum.com/.

google for multi-step, sequential, multistage, etc forms:
http://wiki.rubyonrails.com/rails/pages/HowToBuildMultiStageForms

http://snippets.dzone.com/posts/show/277
http://railsforum.com/viewtopic.php?id=721