Skip to content

Instantly share code, notes, and snippets.

@nicksieger
Created February 10, 2010 20:02
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save nicksieger/300782 to your computer and use it in GitHub Desktop.
Save nicksieger/300782 to your computer and use it in GitHub Desktop.
# Monkeypatch to disable connection pooling in ActiveRecord
module ActiveRecord
module ConnectionAdapters
class ConnectionPool
def checkout
c = ActiveRecord::Base.send(spec.adapter_method, spec.config.dup)
c.verify!
c
end
def checkin(conn)
conn.disconnect!
end
# Disable @connection_mutex around these methods
[:clear_reloadable_connections!, :verify_active_connections!,
:connected?, :disconnect!].each do |m|
aliased_method, punctuation = m.to_s.sub(/([?!=])$/, ''), $1
alias_method m, "#{aliased_method}_without_synchronization#{punctuation}"
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment