无法将 Padrino 连接到带有 activerecord 的 PostgreSQL 数据库
尝试设置 Padrino Web 框架以使用以下信息连接到我的本地 PostgreSQL 数据库:
databases
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)
config/database.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 查看/与数据库对话?
~丹
Trying to setup the Padrino web framework to connect to my local PostgreSQL database with the following info:
databases
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)
config/database.rb
https://gist.github.com/1046031
ActiveRecord::Base.configurations[:development] = {
:adapter => 'postgresql',
:host => 'localhost',
:port => '5432',
:database => 'trustmob_ui_development',
:username => 'postgres',
:password => ''
}
When I try to run padrino rake ar:migrate
I get the following error. Full error Gist here: https://gist.github.com/1046044
rake aborted!
ActiveRecord::ConnectionNotEstablished
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.0.9/....
Not sure what I'm doing wrong. How do I get Padrino to see/talk to the databases?
~Dan
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否在任何地方调用过 ActiveRecord::Base.built_connection ?
Have you call ActiveRecord::Base.establish_connection anywhere?
您可以使用您的代码连接 Navicat 或其他程序吗?
配置正确吗?通过
postgresql.conf
检查您的设置Can you connect with Navicat or other programs with your code?
The config is correct? Check your settings through
postgresql.conf