I have a question about transaction blocks and error handling.
I have an big_object that has an array of other_objects.
So i'm updating these objects from user input and i wrap the whole
thing in a transaction, go through each of the objects verify they are
valid and then save them if they are if they aren't rollback
transaction and jump back to the page and let the user correct their
for other_objects in big_object do |other_object|
#oops! looks like my input validations are bad, abort!
So when i roll back, i throw it back to the page and give the user
some feed back and a chance to correct their mistake. The problem is
the object is in a bad state here, it thinks it is saved. So the
second time my update function is run it goes through says "hey this
time everything is awesome, lets save" and nothing gets saved to the
I know transactions don't rollback the @objects that are inside of
them, any suggestions for got error handling in this situation?