module ActiverecordPostgresqlAutoReconnect

Constants

VERSION

Public Instance Methods

exec_no_cache_with_reconnect(*args) click to toggle source
# File lib/activerecord-postgresql-auto-reconnect/reconnect.rb, line 6
def exec_no_cache_with_reconnect(*args)
  exec_no_cache_without_reconnect(*args)
rescue ActiveRecord::StatementInvalid => e
  if e.to_s.include?('PG::ConnectionBad')
    ActiveRecord::Base.connection_pool.disconnect!
  end
  raise e
end