我在各个地理位置都有多个数据库。每个人在我的database.yml文件中都有自己的表示形式。
运行RAILS_ENV=europe rake db:migrate
时出现以下错误
undefined method `session_store_host' for #<Rails::Application::Configuration:0x000000038fdda8>
堆栈:
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.17/lib/rails/railtie/configuration.rb:85:in `method_missing'
/var/www/vhosts/adm.dyqa.io/html/releases/20190324134144/config/initializers/session_store.rb:9:in `<top (required)>'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:245:in `load'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:245:in `block in load'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:236:in `load_dependency'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:245:in `load'
我的数据库文件:
europe:
adapter: mysql2
encoding: utf8
reconnect: true
database: production
pool: 10
username: USERNAME
password: PASSWORD
host: database.mycompany.europe
port: 1234
danger:
adapter: mysql2
encoding: utf8
reconnect: true
database: production
pool: 10
username: USERNAME
password: PASSWORD
host: database.mycompany.usa
port: 1234
答案 0 :(得分:0)
结果是我缺少配置文件europe.rb
创建该文件后,迁移成功运行。