Rails, sessions, and associations?

I'm running Rails 1.2.3, as a precursor.

I've recently discovered some odd behavior in how Rails treats objects
saved in the session and its associations.

For situations like this, we always save to the database. We’ll use before_filters to load the data from the database on each request… Every night we run a process to purge incomplete records from the database by checking the created_at date We’re usually wiping out records that are 7 days old or more just to be safe. Using a status flag on the table lets me control what “state” the object’s in, and I can have validations that only get fired on certain states, allowing me to save records at any point in the process.

If that idea doesn’t sit well with you, consider the following:

  1. If a user’s browser crashes, they lose their work. With the above method, they could come back and finish.
  2. Marshalling to the session is prone to problems and can be a performance problem.

Just my .02. I’m sure that lots of folks will disagree with my approach.