Skip to content

Instantly share code, notes, and snippets.

@haileys
Created September 24, 2015 07:11
Show Gist options
  • Save haileys/f46ceeb0b800d785e225 to your computer and use it in GitHub Desktop.
Save haileys/f46ceeb0b800d785e225 to your computer and use it in GitHub Desktop.
gem "activerecord", "4.2.4"
require "active_record"
ActiveRecord::Base.logger = Logger.new($stdout)
ActiveRecord::Base.establish_connection :adapter => "mysql2", :database => "test"
# ---------------------------------------------------------------------
ActiveRecord::Base.connection.transaction do
ActiveRecord::Base.connection.transaction do
ActiveRecord::Base.connection.execute("SELECT 1")
raise ActiveRecord::Rollback
end
end
# D, [2015-09-24T17:11:03.692672 #6838] DEBUG -- : (0.1ms) BEGIN
# D, [2015-09-24T17:11:03.692901 #6838] DEBUG -- : (0.1ms) SELECT 1
# D, [2015-09-24T17:11:03.693075 #6838] DEBUG -- : (0.1ms) COMMIT
# ---------------------------------------------------------------------
ActiveRecord::Base.connection.transaction do
ActiveRecord::Base.connection.execute("SELECT 1")
raise ActiveRecord::Rollback
end
# D, [2015-09-24T17:11:03.693277 #6838] DEBUG -- : (0.1ms) BEGIN
# D, [2015-09-24T17:11:03.693460 #6838] DEBUG -- : (0.1ms) SELECT 1
# D, [2015-09-24T17:11:03.693624 #6838] DEBUG -- : (0.1ms) ROLLBACK
# ---------------------------------------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment