I have a multi-page form which creates/edits an event (model held in
session) and it’s invites. When the event is edited I want the user
to be able to modify the invites without saving. For example:
invite = Invite.new "[email protected]
event.invites << invite
Right now this automatically adds that invite to the database. How
can I keep it from doing this until I call “event.save”? I was
thinking about doing a clever validation hook, until I considered
That will delete from the database before calling “event.save()”,
which means the user cannot cancel this action by canceling the flow.
Currently I’m saving the event object in the session.
The user should be able to modify the invitations list all they want
without it being final until they finish the flow.
So far the only thing I can think of is either keeping the invite
associations separate and baking them into the event at the end or
creating a new event “clone” at the beginging and merge at the end.
Neither of these seem like a graceful solution.