0

我正在尝试按照本文档在 Appfog 上运行 rails 控制台。我按照描述设置了我的 database.yml,但是当我运行时出现RAILS_ENV=proxied-appfog rails console此错误:

/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/yaml.rb:133:in `load': syntax error on line 22, col 9: `    adapter: mysql2' (ArgumentError)
    from /.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/yaml.rb:133:in `load'
    from /.rvm/gems/ruby-1.8.7-p352@journal/gems/railties-3.2.13/lib/rails/application/configuration.rb:115:in `database_configuration'
    from /.rvm/gems/ruby-1.8.7-p352@journal/gems/activerecord-3.2.13/lib/active_record/railtie.rb:78
    from /.rvm/gems/ruby-1.8.7-p352@journal/gems/activesupport-3.2.13/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval'
    from /.rvm/gems/ruby-1.8.7-p352@journal/gems/activesupport-3.2.13/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
    from /.rvm/gems/ruby-1.8.7-p352@journal/gems/activesupport-3.2.13/lib/active_support/lazy_load_hooks.rb:26:in `on_load'
    from /.rvm/gems/ruby-1.8.7-p352@journal/gems/activesupport-3.2.13/lib/active_support/lazy_load_hooks.rb:25:in `each'
    from /.rvm/gems/ruby-1.8.7-p352@journal/gems/activesupport-3.2.13/lib/active_support/lazy_load_hooks.rb:25:in `on_load'
    from /.rvm/gems/ruby-1.8.7-p352@journal/gems/activerecord-3.2.13/lib/active_record/railtie.rb:74
    from /.rvm/gems/ruby-1.8.7-p352@journal/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `instance_exec'
    from /.rvm/gems/ruby-1.8.7-p352@journal/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `run'
    from /.rvm/gems/ruby-1.8.7-p352@journal/gems/railties-3.2.13/lib/rails/initializable.rb:55:in `run_initializers'
    from /.rvm/gems/ruby-1.8.7-p352@journal/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `each'
    from /.rvm/gems/ruby-1.8.7-p352@journal/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `run_initializers'
    from /.rvm/gems/ruby-1.8.7-p352@journal/gems/railties-3.2.13/lib/rails/application.rb:136:in `initialize!'
    from /.rvm/gems/ruby-1.8.7-p352@journal/gems/railties-3.2.13/lib/rails/railtie/configurable.rb:30:in `send'
    from /.rvm/gems/ruby-1.8.7-p352@journal/gems/railties-3.2.13/lib/rails/railtie/configurable.rb:30:in `method_missing'
    from /development/baking_journal/config/environment.rb:5
    from /.rvm/gems/ruby-1.8.7-p352@journal/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
    from /.rvm/gems/ruby-1.8.7-p352@journal/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
    from /.rvm/gems/ruby-1.8.7-p352@journal/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency'
    from /.rvm/gems/ruby-1.8.7-p352@journal/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
    from /.rvm/gems/ruby-1.8.7-p352@journal/gems/railties-3.2.13/lib/rails/application.rb:103:in `require_environment!'
    from /.rvm/gems/ruby-1.8.7-p352@journal/gems/railties-3.2.13/lib/rails/commands.rb:40
    from script/rails:6:in `require'
    from script/rails:6

首先,我不想在 rvm 中触摸任何东西……但我确实打开了该文件以查看问题所在,因为它给了我一个行号。该行不包含任何代码。所以我很困惑。这里有什么问题?我唯一能想象的是,也许它不支持我的 ruby​​ 版本?但如果你输入af runtimes返回的列表是:

+---------+-------------+---------+
| Name    | Description | Version |
+---------+-------------+---------+
| python2 |             | 2.7.3   |
| node08  |             | 0.8.14  |
| php     |             | 5.3.10  |
| java    |             | 1.7.0   |
| ruby18  |             | 1.8.7   |
| ruby192 |             | 1.9.2   |
| ruby193 |             | 1.9.3   |
| node04  |             | 0.4.12  |
| node06  |             | 0.6.17  |
+---------+-------------+---------+

有任何想法吗?

此外,如果我尝试af update使用新的 database.yml 和 proxied-appfog.rb 环境文件,我将无法再启动服务器。因此,在我将更改推送到服务器之前,这个错误就给了我。

4

1 回答 1

1

您可以逐字发布您的 database.yml 文件吗?你可能有一个语法错误,与空格相关。YAML 对空格敏感。

仔细检查您的 YML 文件是否存在错误空格。使用两个空格而不是制表符缩进子级别。

于 2013-03-24T20:56:53.977 回答