Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- user = User.new(:login => "login", :password => "password")
- book = Book.new(:title => "title")
- page = Page.new(:summary => "summary")
- work = lambda {
- book.title = "Foooo"
- book.user = user
- page.book = book
- user.save
- book.save
- page.save
- }
- ok = SuperTransaction.execute(work)
- ok #=> true
- book.title #=> "Foooo"
- # the following does not work (would be nice if there was a way to make it work)
- user = User.new(:login => "login", :password => "password")
- book = Book.new(:title => "title")
- page = Page.new(:summary => "summary")
- ok = SuperTransaction.execute do
- book.title = "Foooo"
- book.user = user
- page.book = book
- user.save
- book.save
- page.save
- end
- ok #=> true
- book.title #=> nil
Add Comment
Please, Sign In to add comment