2013-01-07 62 views
0

我正在使用Ruby on Rails(rails版本2.3.4),並在Windows上使用pg gem(版本0.12.2)。 我的database.yml文件有以下內容:Ruby on Rails錯誤:無效的連接「適配器」

production: 
    adapter: postgresql 
    encoding: utf8 
    host: localhost 
    database: canvas4 
    username: canvas 
    password: canvas 
    port: 5433 
    timeout: 5000 
    pool: 5 
    queue: 
    adapter: postgresql 
    encoding: utf8 
    database: canvas4_queue 
    host: localhost 
    port: 5433 
    username: canvas 
    password: canvas 
    timeout: 5000 
    pool: 5 

但是當我運行命令:bundle exec rake db:initial_setup RAILS_ENV=production,出現錯誤:

Invalid connection "adapter"

我也試圖與gem "activerecord-postgresql-adapter"但同樣的錯誤如上所述。

我可以用sqlite3驅動程序成功安裝。

你知道如何讓postgresql適配器使用rails 2.3嗎?

回答

1

確保您的database.yml中的數據庫適配器設置爲「postgresql」。如果你仍然有同樣的問題,那麼請嘗試使用純Ruby適配器:

創業板安裝的Postgres-PR

(請務必卸載PG寶石之前......以避免衝突)

如果它有效,那麼這是postgres寶石的問題。無論如何,出於發展目的,使用純紅寶石通常是可以的。