1

尝试设置 Padrino Web 框架以使用以下信息连接到我的本地 PostgreSQL 数据库:

数据库

       List of databases
| Name                   |  Owner
|------------------------|------------ 
| postgres               | postgres
| template0              | postgres
| template1              | postgres
|trustmob_ui_development | postgres
|trustmob_ui_production  | postgres 
|trustmob_ui_test        | postgres
(6 rows)

配置/数据库 .rb https://gist.github.com/1046031

ActiveRecord::Base.configurations[:development] = {
:adapter => 'postgresql',
:host => 'localhost',
:port => '5432',
:database => 'trustmob_ui_development',
:username  => 'postgres',
:password  => ''
}

当我尝试运行时padrino rake ar:migrate,出现以下错误。完整的错误要​​点在这里:https ://gist.github.com/1046044

rake aborted!
ActiveRecord::ConnectionNotEstablished
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.0.9/.... 

不知道我做错了什么。如何让 Padrino 查看/与数据库对话?

~丹

4

2 回答 2

1

你有没有在任何地方调用 ActiveRecord::Base.establish_connection?

于 2012-07-01T19:55:57.030 回答
0

你能用你的代码连接 Navicat 或其他程序吗?

配置正确吗?通过检查您的设置postgresql.conf

于 2011-06-25T08:16:03.837 回答