Search code examples
ruby-on-railsformsworkflowpreview

How does 37signals job preview functionality work?


I'm interested in getting preview functionality working similar to how the 37signals job site does: http://jobs.37signals.com. Below are some screen shots of how it works.

So assuming you have Post model where Step 1 usually takes place in the new/create view/actions, how should one continue to Step 2 Preview and then after previewing, proceeding to the Step 3 publishing the post/ad?

Do they actually save the ad/post in the database before continuing to Step 2 (Preview) but set a flag (like a boolean field called preview set to true)? It looks like they set a token paramater but I'm not sure what it's used for)

I'm interested in this because it seems to go against the CRUD/REST and I thought it would be good to know how it worked.


Solution

  • They might be using a state_machine so when it is created it needs to be confirmed then when it is confirmed it needs to be paid. then they just hold the state in the db with the record

    http://github.com/pluginaweek/state_machine