Skip to content

Instantly share code, notes, and snippets.

@evtuhovich
Created December 8, 2010 20:19
Show Gist options
  • Save evtuhovich/733842 to your computer and use it in GitHub Desktop.
Save evtuhovich/733842 to your computer and use it in GitHub Desktop.
Rails 2.3.x nested transaction rollback
# File 1.rb, use rails 2.3.10
require 'config/environment'
puts Message.count
Message.transaction do
Message.create! :author => 'test', :text => 'test'
Message.transaction do
Message.create! :author => 'test', :text => 'test'
raise ActiveRecord::Rollback
end
end
puts Message.count
$ ruby 1.rb
0
2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment