Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# 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