Skip to content

Instantly share code, notes, and snippets.

@reu
Created September 27, 2010 13:36
Show Gist options
  • Save reu/599035 to your computer and use it in GitHub Desktop.
Save reu/599035 to your computer and use it in GitHub Desktop.
class CQM < ActiveRecord::Base
self.abstract_class = true
establish_connection(
:adapter => "mysql2",
:host => "localhost",
:username => "root",
:password => "root",
:database => "cqm_development"
)
end
class Abend < CQM
end
class BlueIdeas < ActiveRecord::Base
self.abstract_class = true
establish_connection(
:adapter => "mysql2",
:host => "localhost",
:username => "root",
:password => "root",
:database => "blue-ideas_development"
)
end
class Comment < BlueIdeas
end
Comment.transaction do
Comment.create :user_id => 1, :idea_id => 1, :body => "ROLLBACKS!"
Abend.transaction do
Abend.create :job_id => 1, :return_code => 1, :abended_on => Time.now
end
raise "oh noes!"
end
class Log < ActiveRecord::Base
end
class Comment < ActiveRecord::Base
end
Comment.establish_connection(
:adapter => "mysql2",
:host => "localhost",
:username => "root",
:password => "root",
:database => "blue-ideas_development"
)
Log.establish_connection(
:adapter => "mysql2",
:host => "localhost",
:username => "root",
:password => "root",
:database => "blue-ideas_development"
)
Comment.transaction do
Comment.create :user_id => 1, :idea_id => 1, :body => "ROLLBACKS!"
Log.transaction do
Log.create :description => "SHIT|"
end
raise "oh noes!"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment