-
Notifications
You must be signed in to change notification settings - Fork 38
Idea on how to encapsulate many ORM operations into a transaction ? #9
Comments
after looking into the code, I have a possible idea:
of course is mandated to the library user to call DBObject.startTxn() and commit/rollback and the end of ORM operations. what do you think? can be a viable idea? |
Without the support of Ruby's codeblocks, I think your suggestion is the best idea. If you want to start something, I can take a look. Thanks! b |
Hi! Also tests has been included. |
Excellent - thanks. I'll take a look this weekend. |
Hi, did you had time to check the implementation? what do you think about it? |
Sorry - been slammed - will try to look this week. |
whops, sorry, hope all is ok :) |
I looked through your changes - other than the one line note, I think everything looks good. Would you be willing to write some basic docs for transactions? If so, you can just make a transactions.xhml file in the docs folder (using lore). Thanks again! |
ok, I've fixed the one line code and added some documentation. if you like it, please merge it :) |
any status updates on this one? |
This one needs a code review with some modifications necessary - I just haven't had a chance to go through it yet. |
I'm thinking a way to implement a transaction handling to protect several operations,
somethink like AR does:
Account.transaction do
balance.save!
account.save!
end
(see http://api.rubyonrails.org/classes/ActiveRecord/Transactions/ClassMethods.html for other examples).
this is very useful when you want to do several operations with the orm and rollback if any of these operations fails. The rollback can be automatic (like twisted txns do) and an exception can be raised back to the application.
what do you suggest can be the best way to implement into twistar ?
I can start looking at it...
The text was updated successfully, but these errors were encountered: