search for: generate_document

Displaying 1 result from an estimated 1 matches for "generate_document".

2008 Apr 30
6
best practice for object transaction?
I have a new @offer that needs to generate a document if saved. But that''s all or nothing: transaction do @offer.save! generate_document end # handle exceptions if needed If save! fails everything is fine, but if generate_document raises an exception @offer is left as a model with timestamps, id, which is not a new_record? anymore (though the database was rolled back). I''ve played a bit cloning, and with the o...