Question: Cannot connect to database through active record in my Sinatra app on Windows 10, no issue on OSX but I would still like to be able to develop from my Windows machine. 

Full error:
C:/Ruby23-x64/lib/ruby/2.3.0/rubygems/core\_ext/kernel\_require.rb:120:in `require': Could not load 'active\_record/connection\_adapters/postgresql\_adapter'. Make sure that the adapter in config/database.yml is valid. If you use an adapter other than 'mysql2', 'postgresql' or 'sqlite3' add the necessary adapter gem to the Gemfile. (LoadError)

Ruby version: 2.3.1

```
gem 'pg'

```

^^ is included in the Gemfile

```
 require 'sinatra/activerecord'

```

^^ in app.rb

Not relevant: [Could not load 'active\_record/connection\_adapters/postgresql\_adapter'](https://stackoverflow.com/questions/29648461/could-not-load-active-record-connection-adapters-postgresql-adapter)

Environments.rb : 

```
configure :development do

 ActiveRecord::Base.establish_connection(
   :adapter  => db.scheme == 'postgres' ? 'postgresql' : db.scheme,
   :host     => 'localhost',
   :username => 'postgres',
   :password => '******',
   :database => '******',
   :port => 5432
   :encoding => 'utf8'
 )
end

```

database.yml:
development:
 adapter: postgresql
 encoding: unicode
 database: Same as environments.rb
 pool: 5
 username: Same as environments.rb
 password: Same as environments.rb

Answer: 
I'm not sure why exactly, but Ruby version 2.3.1 doesn't do well with Sinatra on Windows. I downgraded to Ruby 2.2.5 and kept activeRecord '5.0.0' and everything worked fine.
Your adapter in enviroments.rb should just be `postgresql`. Nothing else.