Verbose Logging

software development with some really amazing hair

T + G I F R

Getting Rid Of Transactions For The Poor Man

· · Posted in Programming
Tagged with

A quick post for today.

Want to get rid of transactions from ActiveRecord for something? Here's a cheap way to do it.

# Force the loading of AR stuff
ActiveRecord::Base.connection.execute('SELECT 1')
# Remove transactions from MySQL adapter
ActiveRecord::ConnectionAdapters::MysqlAdapter.class_eval do
def begin_db_transaction
end
def commit_db_transaction
end
end

It only works for MySQL obviously, but you can roll your own if you are on postgres. I'll make it a bit less crappy and make it a gem or something.