gpt4 book ai didi

ruby-on-rails - database.yml &references 不工作

转载 作者:数据小太阳 更新时间:2023-10-29 06:52:06 25 4
gpt4 key购买 nike

我们刚刚将虚拟机升级到我认为相同的 ruby​​ 配置(通过 RVM...Ruby 1.9.2、Rails 3.0.7、DataMapper 1.1.0)。最大的区别是我们从 MySQL 5.0 升级到 5.1。

出于某种原因,在我们的旧 VM 上运行的完全相同的代码/database.yml 现在在我们的新 VM 尝试连接到数据库时失败了。

问题是这个 YAML:

mysql_defaults: &mysql_defaults
adapter: mysql
encoding: UTF-8
username: user
password: pass
host: localhost

development:
<<: *mysql_defaults
database: devdb

production:
<<: *mysql_defaults
database: productiondb
host: master.db.site.com

正在扩展到:

  "mysql_defaults" => {
"adapter"=>"mysql",
"encoding"=>"UTF-8",
"username"=>"user",
"password"=>"pass",
"host"=>"localhost"
},
"development" => {
"adapter"=>"mysql",
"encoding"=>"UTF-8",
"username"=>"user",
"password"=>"pass",
"host"=>"localhost"
},
"production" => {
"adapter"=>"mysql",
"encoding"=>"UTF-8",
"username"=>"user",
"password"=>"pass",
"host"=>"localhost"
}

代替:

  "mysql_defaults" => {
"adapter"=>"mysql",
"encoding"=>"UTF-8",
"username"=>"user",
"password"=>"pass",
"host"=>"localhost"
},
"development" => {
"adapter"=>"mysql",
"encoding"=>"UTF-8",
"username"=>"user",
"password"=>"pass",
"host"=>"localhost",
"database"=>"devdb"
},
"production" => {
"adapter"=>"mysql",
"encoding"=>"UTF-8",
"username"=>"user",
"password"=>"pass",
"host"=>"master.db.site.com",
"database"=>"productiondb"
}

以前有人遇到过这种情况吗?

根据 Gemfile.lock(为了理智起见,我删除了它并再次运行 bundle install),所有安装的依赖项都是相同的(即 Gemfile.lock 在新旧设置之间没有区别)。 database.yml 也没有。

最佳答案

Psych 是新的 YAML 解析器,它可能更好但不能合并哈希键。

这应该有帮助 http://pivotallabs.com/users/mkocher/blog/articles/1692-yaml-psych-and-ruby-1-9-2-p180-here-there-be-dragons

关于ruby-on-rails - database.yml &references 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6140493/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com