【问题标题】:Rails4 Deploy ActiveRecord::AdapterNotSpecifiedRails4 部署 ActiveRecord::AdapterNotSpecified
【发布时间】:2014-03-26 18:46:47
【问题描述】:

我的部署运行良好,直到迁移..失败

    rake aborted!
    DEBUG [874287b0]    ActiveRecord::AdapterNotSpecified: database configuration does not specify adapter
    DEBUG [874287b0]    /home/kadoudal/rails/swim-tech.eu/site/swimtech/shared/bundle/ruby/2.1.0/gems/activerecord-4.0.3/lib/active_record/connection_adapters/connection_specification.rb:52:in `resolve_hash_connection'

我运行:cap staging deploy:check:linked_files,成功,database.yml 符号链接正确并包含:

# encoding: utf-8

 defaults: &defaults
     adapter: mysql2
    host: localhost
    timeout: 60000
    encoding: utf8


production:
     <<: *defaults
    database: mydb_production
    username: xxxxxxxxxxx
    password: xxxxxxxxxxxxxx

为什么找不到适配器?

【问题讨论】:

    标签: mysql ruby-on-rails-4 migration capistrano


    【解决方案1】:

    忘了我正在运行 cap staging.... 并且 database.yml 中没有 staging db

    【讨论】:

      【解决方案2】:

      我通过克隆 Rackspace 上的生产服务器创建了一个登台服务器。在这种情况下,我希望登台服务器仍然使用“生产”rails 环境和生产数据库(在登台服务器上),所以我在 config/deploy/staging.rb 文件中进行了设置:

      set :stage, :production
      

      而且效果很好。

      【讨论】:

        猜你喜欢
        • 2015-07-01
        • 2017-03-27
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2023-04-10
        • 2022-08-19
        • 1970-01-01
        相关资源
        最近更新 更多