Rails / ActiveRecord - AdapterNotSpecified, even though it is

前端 未结 2 1989
情歌与酒
情歌与酒 2021-01-12 03:37

I\'m doing the Ruby on Rails Tutorial. For the first three chapters it uses SQLite, but later it suggests using PostgreSQL on development for easier Heroku deploys. After ed

相关标签:
2条回答
  • 2021-01-12 04:11

    Indentation was the culprit for me.

    Rails it seems has a strict way of reading db type (development or production) and the db settings (adapter, host, username, etc etc) from the yml file.

    But of course the ActiveRecord error msg was overkill.. it made it look like I was missing a gem

    0 讨论(0)
  • 2021-01-12 04:21

    You did not define the database for the test environment. Your database.yml file should look like:

    development:
      adapter: postgresql
      host: localhost
      username: nekkoru
      password: derpderp
      database: development
      encoding: UTF8
    
    test:
      adapter: postgresql
      host: localhost
      username: nekkoru
      password: derpderp
      database: test        # or whatever the name is
      encoding: UTF8
    
    0 讨论(0)
提交回复
热议问题