【问题标题】:Rake db:migrate rails with error undefined method `session_store_host`Rake db:使用错误未定义方法`session_store_host`迁移rails
【发布时间】:2019-08-14 22:32:54
【问题描述】:

我有多个跨地理位置的数据库。在我的 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

【问题讨论】:

  • 可以分享/config/environments/europe.rb的内容吗?
  • 这是我的问题,我缺少环境配置文件!谢谢你!

标签: ruby-on-rails database-migration


【解决方案1】:

原来我错过了配置文件europe.rb 创建后,迁移成功运行。

【讨论】:

    猜你喜欢
    • 2014-05-19
    • 1970-01-01
    • 2011-09-04
    • 2017-01-11
    • 2011-04-29
    • 2019-10-17
    • 2011-09-07
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多