Я просматриваю основной учебник по рельсам, и когда я пытаюсь запустить свой сервер с помощью «rails s» Я получаю ActiveRecord :: ConnectionNotEstablished в моем браузере localhost: 3000.Убедитесь, что файл database.yml имеет правильные учетные данные
В учебнике сказано, что у моего 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
Спасибо!
Просто давая нам свой 'database.yml' файл не поможет. Habe вы установили PostgreSQL? Обеспечили ли вы, что сервер PostgreSQL запущен? Можете ли вы напрямую подключиться к базе данных PostgreSQL на вашем компьютере, запустив «psql -U postgres postgres»? –