Displaying 1 result from an estimated 1 matches for "deliver_comment".
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