Rails: No connection pool for ActiveRecord::Base

后端 未结 9 1085
梦毁少年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:17

    For PostgreSQL your database.yml file should look something like that:

    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: your_db_name
    

    Also make sure that you have the gem installed: in your Gemfile:

    gem 'pg'
    

    Finally, restart your server.

    Hope that helps

    Edit: I almost forgot, make sure you have your PostgresSQL running, check this link for download and setup.

提交回复
热议问题