哇我已经被困在这一天了几天.我无法连接到Heroku上的database.yml.我在雪松和ruby1.9.2.我的开发人员和测试dbs是sqlite3,而prod db是postgresql来应对Cedar规则.
这是我的ruby脚本中的代码:
这是我的ruby脚本中的代码:
Rails.env.production? ? (env = "production") : (env = "development") dbconfig = YAML::load(File.open('config/database.yml'))[env] ActiveRecord::Base.establish_connection(dbconfig)
一切在当地都很好,但当我推到Heroku,我得到:@H_502_6@
ArgumentError: Syntax error on line 17,col 0: `adapter = uri.scheme' from /usr/local/lib/ruby/1.9.1/syck.rb:135:in `load'
看来Heroku不喜欢我的database.yml.这是一个概述:@H_502_6@
development: adapter: sqlite3 database: db/development.sqlite3 pool: 5 timeout: 5000 test: adapter: sqlite3 database: db/test.sqlite3 pool: 5 timeout: 5000 production: adapter: postgresql encoding: unicode database: foo port: 5432 host: foobar.amazonaws.com username: foo password: bar