在Heroku中RoR多个数据库连接

时间:2014-02-16 13:08:40

标签: ruby-on-rails ruby activerecord heroku

我的ruby on rails应用程序包含两个数据库连接,它在localhost中运行良好,但它不能用于heroku。得到此错误

/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/connection_adapters/connection_specification.rb:52:in 'resolve_hash_connection': database configuration does not specify adapter (ActiveRecord::AdapterNotSpecified)

的database.yml

production:
  adapter: mysql2
  encoding: unicode
  database: first_database
  pool: 5
  username: root
  password: 

production:
  adapter: mysql2
  encoding: unicode
  database: second_database
  pool: 5
  username: root
  password: 

由于heroku覆盖了默认的database.yml文件,我按照本教程https://roratmindfiresolutions.wordpress.com/2013/05/27/connect-to-remote-database-server-from-heroku在heroku上设置了多个数据库连接,但仍然没有变化。我正在使用rails 4.0.1。任何帮助和建议都非常值得注意。感谢。

1 个答案:

答案 0 :(得分:0)

请注意,在他的YAML文件中,他将其称为productionproduction_sec,而您使用production两次。