Looking for ruby-on-rails Answers? Try Ask4KnowledgeBase
Looking for ruby-on-rails Keywords? Try Ask4Keywords

Ruby on RailsActiveRecord Transactions


Remarks

Transactions are protective blocks where SQL statements are only permanent if they can all succeed as one atomic action. The classic example is a transfer between two accounts where you can only have a deposit if the withdrawal succeeded and vice versa. Transactions enforce the integrity of the database and guard the data against program errors or database break-downs. So basically you should use transaction blocks whenever you have a number of statements that must be executed together or not at all.