Rails: No connection pool for ActiveRecord::Base

后端 未结 9 1054
梦毁少年i
梦毁少年i 2020-12-29 07:27

I\'m trying to use rails 4.2.6 to develop an app. I\'m trying to use postgres for database. Server starts fine but when I try loading a page it throws this \"No connection p

9条回答
  •  既然无缘
    2020-12-29 08:08

    Rails 5

    New app

    Using Postgresql for both test and development

    Specs run, so Rails can connect to Postgresql

    But when I started the web app, I got "No connection pool with id primary found."

    Ran 'bin/rails db:migrate:reset' and restarted the app. It worked. No idea why.

    database.yml:

        development:
          adapter: postgresql
          encoding: unicode
          database: rails5_development
          pool: 5
          username: foo
          password: bar
          host: localhost
          port: 5432
    
        test:
          adapter: postgresql
          encoding: unicode
          database: rails5_test
          pool: 5
          username: foo
          password: bar
          host: localhost
          port: 5432
    

提交回复
热议问题