ruby-on-rails – 使database.yml文件在OSX上的Rails中运行

我知道在osx上使用postgres有点困难,因为它有自己的版本运行,所以为了psql到它你需要提供像这样的主机名

psql -h localhost mydatabasename -U me

但是,如何为您的database.yml文件执行此操作以获取所有轨道可爱性.

如果您尝试连接

development:
  adapter: postgresql
  username: me
  database: mydatabasename

你收到了经典

Couldn't create database for {"adapter"=>"postgresql","username"=>"me","database"=>"mydatabasename"}
could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/tmp/.s.PGSQL.5432"?

关于如何提供信息或配置osx的任何想法都不要吮吸这么多?!

解决方法

如果您能够使用psql连接到localhost上的Postgres,那么只需添加:
host: localhost

到database.yml

相关文章

validates:conclusion,:presence=>true,:inclusion=>{...
一、redis集群搭建redis3.0以前,提供了Sentinel工具来监控各...
分享一下我老师大神的人工智能教程。零基础!通俗易懂!风趣...
上一篇博文 ruby传参之引用类型 里边定义了一个方法名 mo...
一编程与编程语言 什么是编程语言? 能够被计算机所识别的表...
Ruby类和对象Ruby是一种完美的面向对象编程语言。面向对象编...