2013-01-07 36 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宝石的问题。无论如何,出于发展目的,使用纯红宝石通常是可以的。