Rails 6 on Heroku: ActiveRecord::AdapterNotSpecified: database configuration does not specify adapter
The problem has been solved by adding the 'adapter' to 'production' in the database.yml. This wasn't necessary when our project was on Rails 4 and 5.
production:
adapter: postgresql
ActiveRecord::AdapterNotSpecified database configuration does not specify adapter
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_developmentrun
rake db:migrate
Database configuration does not specify adapter (Sinatra + Heroku + Activerecord)
I had the same problem today, and contacted Heroku support for assistance.
They directed me to a recent change in their Ruby build pack, see here: https://devcenter.heroku.com/changelog-items/709
I updated my database.yml file to reflect the change, and reference the DATABASE_URL for production, and my app is deploying again.
production:
url: <%= ENV['DATABASE_URL'] %>
Rails 5 Upgrade Issue: database configuration does not specify adapter
I found the solution to this problem, it turns out that in my case since I was connecting to multiple databases that there was a subtle change in what Rails 5 expected over Rails 4.
If you are connecting to multiple databases the establish_connection used within the model connecting to the separate database requires a symbol instead of a string in Rails 5.
Works
establish_connection :secondary_database
Where as the following no longer works:
establish_connection "secondary_database"
In my case some of my old database connections had used the string argument and were failing, causing me to think that there was an strange incompatibility between Rails 5 and my code base. I thought I would share this as I do not see it documented anywhere specifically.
Related Topics
What Does the * (Star) Mean in Ruby
How to Set Http_Referer When Testing in Rails
How to Download via Http Only Piece of Big File with Ruby
Capturing Groups Don't Work as Expected with Ruby Scan Method
Can Someone Explain the Class.Superclass.Class.Superclass Paradox
Ruby String to Date Conversion
Rails 4 Unpermitted Parameters for Array
How to Find the Unique Elements in an Array in Ruby
How to Make Instance Variables Private in Ruby
Installing Ruby on MAC Os X 10.8.2
How to Alter the Timezone of a Datetime in Ruby
Errno::Econnrefused: Connection Refused - Connect(2) for Action Mailer
Select Arrays Between Date Ranges with Ruby
Bundle Command Not Found. Bad Interpreter