0

I recently switched my test database to be postgrsql from sqlite3. Since doing so, when I follow the instruction here: https://devcenter.heroku.com/articles/rails-asset-pipeline on deploying my assets to heroku, I get the following error:

database configuration does not specify adapter

This happens after running this step

RAILS_ENV=production bundle exec rake assets:precompile

I tried following the instructions from this post and it did not work.

bundle exec rake assets:precompile - database configuration does not specify adapter

I'm guessing it has something to do with my database.yml file, which is here

development:
  adapter: postgresql
  database: playerpong_database
  pool: 5
  timeout: 5000
  encoding: unicode
  host: localhost

Any ideas?

Community
  • 1
  • 1
brad
  • 1,675
  • 2
  • 16
  • 23

3 Answers3

2

I figured it out. I added a production section to my database.yml file.

production:
  adapter: postgresql
  database: playerpong_database
  pool: 5
  timeout: 5000
  encoding: unicode
  host: my_app_url

I didn't think this was needed.

brad
  • 1,675
  • 2
  • 16
  • 23
2

Just pass a dummy database as mentioned in this article:

https://iprog.com/posting/2013/07/errors-when-precompiling-assets-in-rails-4-0

The command is: bundle exec rake RAILS_ENV=production DATABASE_URL=postgresql://user:pass@127.0.0.1/dbname assets:precompile

Yazan Khalaileh
  • 589
  • 6
  • 15
1

The problem is you are running

RAILS_ENV=production bundle exec rake assets:precompile

where as your file has development adapter , and so the error comes to be like the adapter is missing. You need to either change the environment article to development

RAILS_ENV=development bundle exec rake assets:precompile

or change the development directive to production

production:
  adapter: postgresql
  database: playerpong_database
  pool: 5
  timeout: 5000
  encoding: unicode
  host: localhost
Asim Mushtaq
  • 445
  • 5
  • 14