Skip to content

Instantly share code, notes, and snippets.

@sycobuny
Created March 18, 2013 15:22
Show Gist options
  • Save sycobuny/5187938 to your computer and use it in GitHub Desktop.
Save sycobuny/5187938 to your computer and use it in GitHub Desktop.
Trying to get transactions to misbehave similar to https://gist.github.com/rintaun/5186914
require 'sequel'
require 'logger'
DB = Sequel.postgres('steve', :host => 'localhost')
DB.loggers << Logger.new($stdout)
# DB.run 'CREATE TABLE cars (id SERIAL PRIMARY KEY, asdf TEXT NOT NULL) WITHOUT OIDS;'
class Car < Sequel::Model
end
DB.transaction do
Car.new do |car|
car.asdf = 'Saturn'
car.save
end
Car.new do |car|
car.save
end
puts "Sup guys"
end
# DB.run 'DROP TABLE cars;'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment