I have a form which spans multiple pages. The way it is set up now is not ideal because it saves (to the database) each page when it is submitted. So if the user does not complete the form across all pages there would be an incomplete user registration saved in the database.
I would like to ‘rollback’ the saves if the user doesn’t fully fill in the form.
So is there a way to set up a transaction that would begin when the user fills out the first form and ends when the user finishes on the last page?
What you’re looking for is the acts_as_state_machine gem. If you’re unfamiliar with State Machines, take a look here.