ActiveRecord::AdapterNotSpecified database configuration does not specify adapter
You didn't show the command causing this query, but this could happen if you pass a string and not a symbol.
For example:
irb(main):001:0> ActiveRecord::Base.establish_connection("#{Rails.env}")
ActiveRecord::AdapterNotSpecified: database configuration does not specify adapter
But then if you use a symbol, it will work.
irb(main):001:0> ActiveRecord::Base.establish_connection("#{Rails.env}".to_sym)
=> #<ActiveRecord::ConnectionAdapters::ConnectionPool:0x007f2f484a32a0 #....
For you app to work locally you need to:
- Install Postgresql on your machine
- Create a database for your development needs (let's call it
my_app_development
) Change your
database.yml
to:default: &default adapter: postgresql encoding: unicode # For details on connection pooling, see rails configuration guide # http://guides.rubyonrails.org/configuring.html#database-pooling pool: 5 development: <<: *default database: my_app_development
run
rake db:migrate
Your database.yml should look something like this:
default: &default
adapter: postgresql
encoding: unicode
# For details on connection pooling, see rails configuration guide
# http://guides.rubyonrails.org/configuring.html#database-pooling
pool: 5
username: my_username
password: my_password
development:
<<: *default
database: "development_database_name"
test:
<<: *default
database: "test_database_name"
production:
<<: *default
database: "production_database_name"
Edit development_database_name to your local database name. Also edit my_username and my_password to your correct db username and password.