http://ruby.railstutorial.org/ version 3.2で勉強中
6.2.1 セクションの最後で次のように詰まっています。
$ bundle exec rake db:test:prepare
rake aborted!
FATAL: no pg_hba.conf entry for host "192.168.108.1", user "sample_user", database "postgres", SSL on
FATAL: no pg_hba.conf entry for host "192.168.108.1", user "sample_user", database "postgres", SSL off
Tasks: TOP => db:test:load => db:test:purge
192.168.108.1 は私の IP です。database.yml に別のエントリがあるのに、なぜそれを探しているのですか? ユーザー sample_user はすべてのデータベースの所有者であり、それらに CREATEDB があります。192.168.108.1 から psql を使用して、192.168.108.2 上の任意のデータベースに正常に接続できます。
リモートpostgresをまだ使用しているのに、どうやってそれを克服するのですか?
Gemfile
source 'https://rubygems.org'
gem 'rails', '3.2.3'
gem 'bootstrap-sass', '2.0.0'
gem 'pg', '0.12.2'
group :development, :test do
gem 'rspec-rails', '2.9.0'
end
group :assets do
gem 'sass-rails', '3.2.4'
gem 'coffee-rails', '3.2.2'
gem 'uglifier', '1.2.3'
end
gem 'jquery-rails', '2.0.0'
group :development do
gem 'annotate', '~> 2.4.1.beta'
end
group :test do
gem 'capybara', '1.1.2'
gem 'spork', '0.9.0'
end
データベース.yml
common: &common
adapter: postgresql
username: sample_user
password: qwerty123
host: 192.168.108.2
development:
<<: *common
database: sample_db_dev
test:
<<: *common
database: sample_db_tst
production:
<<: *common
database: sample_db_pro
192.168.108.2 の pg_hba.conf
host sample_db_dev sample_user 192.168.108.1/32 md5
host sample_db_tst sample_user 192.168.108.1/32 md5
host sample_db_pro sample_user 192.168.108.1/32 md5
192.168.108.1 にローカルの pg_hba.conf がありません
ruby 1.9.3p125 Rails 3.2.3 psql (PostgreSQL) 8.4.11