DEV Community

Discussion on: The Complexity of Active Record Transactions

Collapse
 
janko profile image
Janko Marohnić

Thanks! Yes, that shouldn't be difficult to do, but I suppose Active Record wants to prevent you from running into that performance problem to begin with. Personally, with Active Record it wouldn't come to my mind to add if record.changed?, because I assume record.save will not do anything if no columns changed. But instead of making ActiveRecord::Base#save not open a transaction in this case, which would avoid that problem, it was somehow better to implement lazy transactions? 🤷‍♂️