Guest User

Untitled

a guest
Feb 20th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. module DataMapper
  2.  
  3. # I was considering calling this "DataMapperMakesMeCry"
  4. module WrapDBChangesInTransactions
  5.  
  6. def save(*args)
  7. transaction do
  8. super
  9. end
  10. end
  11.  
  12. def destroy(*args)
  13. # Don't look at the implementation of transactions. It's a bit scary.
  14. transaction do
  15. super
  16. end
  17. end
  18.  
  19. end
  20.  
  21. Resource.append_inclusions(WrapDBChangesInTransactions)
  22.  
  23. end
Add Comment
Please, Sign In to add comment