# Best Practices for Multi-step Record Creation

**URL:** <https://www.ruby-forum.com/t/best-practices-for-multi-step-record-creation/157556>\
**Category:** Rails\
**Created:** [January 13, 2009, 3:09am UTC](https://www.ruby-forum.com/t/best-practices-for-multi-step-record-creation/157556 "2009-01-13T03:09:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![gavvin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/db5fbb/32.png) [@gavvin](https://www.ruby-forum.com/u/gavvin)\
**Post date:** [January 13, 2009, 3:09am UTC](https://www.ruby-forum.com/t/best-practices-for-multi-step-record-creation/157556/1 "2009-01-13T03:09:43Z")

</div>

class Activity  
has\_many :locations

In activities#new, I navigate away and select a location (among other  
things) on a map. At this point, the @activity is still missing  
attributes and is invalid. What is the best practice for preserving  
the state of this invalid record until I return to it? I could:

1. Make all validations conditional depending on the state of the  
record. But this seems pretty clunky. I want to be able to call  
#valid? and get the correct answer.

2. Create a supper class RawActivity with no validations and then let  
Activity inherit from it when it’s ready to be saved. This also looks  
like a messy solution.

3. Dump all the @activity attributes into the session, reconstitute  
them in the Location controller. Find the location, dump the  
@location attributes into session. Go back to the Activity controller  
and stitch it all together. Yuck.

4. Render the form in javascript and hide everything until it’s ready  
to be saved.

Am I missing something? What’s the best practice?
