Daniel Huckstep Daniel Huckstep - 1 year ago 146
Ruby Question

Disable transactions in ActiveRecord

How do I disable transactions in Rails' ActiveRecord? I have a specific situation where I want them to go away I can't seem to find anything useful out there. Is it even possible?

Answer Source

Poor man's "no transactions"

# Force the loading of AR stuff
ActiveRecord::Base.connection.execute('SELECT 1')

# Remove transactions
ActiveRecord::ConnectionAdapters::MysqlAdapter.class_eval do
  def begin_db_transaction

  def commit_db_transaction