I fixed an issue on my rails project locally (with postgres config) while adding in database.yml this statement:
test:
prepared_statements: false
You can pass in a configuration hash to ActiveRecord::Base.establish_connection, in an initializer. For example:
configure :production, :development, :test do
db = URI.parse(ENV['DATABASE_URL']
ActiveRecord::Base.establish_connection(
:adapter => db.scheme == 'postgres' ? 'postgresql' : db.scheme,
:host => db.host,
:username => db.user,
:password => db.password,
:database => db.path[1..-1],
:encoding => 'utf8',
:prepared_statements => false,
)
end
http://apidock.com/rails/ActiveRecord/Base/establish_connection/class