Guest User

Untitled

a guest
Mar 6th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. user = User.new(:login => "login", :password => "password")
  2. book = Book.new(:title => "title")
  3. page = Page.new(:summary => "summary")
  4. work = lambda {
  5. book.title = "Foooo"
  6. book.user = user
  7. page.book = book
  8. user.save
  9. book.save
  10. page.save
  11. }
  12. ok = SuperTransaction.execute(work)
  13. ok #=> true
  14. book.title #=> "Foooo"
  15.  
  16. # the following does not work (would be nice if there was a way to make it work)
  17.  
  18. user = User.new(:login => "login", :password => "password")
  19. book = Book.new(:title => "title")
  20. page = Page.new(:summary => "summary")
  21. ok = SuperTransaction.execute do
  22. book.title = "Foooo"
  23. book.user = user
  24. page.book = book
  25. user.save
  26. book.save
  27. page.save
  28. end
  29. ok #=> true
  30. book.title #=> nil
Add Comment
Please, Sign In to add comment