Skip to content

Instantly share code, notes, and snippets.

@ncr
Created September 17, 2010 13:58
Show Gist options
  • Save ncr/584273 to your computer and use it in GitHub Desktop.
Save ncr/584273 to your computer and use it in GitHub Desktop.
# put this in config/initializers
class NoopArray < Array
def <<(e)
self
end
def push(e)
self
end
def concat(a)
self
end
end
ActiveRecord::ConnectionAdapters::AbstractAdapter.set_callback(:checkout, :before) do |a|
cta = :@_current_transaction_records
a.instance_variable_set(cta, NoopArray.new) unless a.instance_variable_defined?(cta)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment