我正在学习一个基本的 rails 教程,当我尝试使用“rails s”运行我的服务器时,我在我的 localhost:3000 浏览器中得到了 ActiveRecord::ConnectionNotEstablished。
教程中告诉我要确保我的 database.yml 具有正确的凭据,但没有告诉我如何执行此操作。我正在使用 Postgresql。这就是我的databse.yml 中的内容:
# SQLite version 3.x
# gem install sqlite3
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem 'sqlite3'
development:
adapter: postgresql
database: myrubyblog
username:postgres
password: theoffice
pool: 5
timeout: 5000
host: localhost
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
adapter: postgresql
database: myrubyblog
username:postgres
password: theoffice
pool: 5
timeout: 5000
host: localhost
production:
adapter: postgresql
database: myrubyblog
username:postgres
password: theoffice
pool: 5
timeout: 5000
host: localhost
谢谢!