0

我已经为 Heroku 部署了一个应用程序。该应用程序在开发中运行良好,并且测试通过。部署工作正常,网络服务器正在运行。但是 en.yml 文件中的以下行导致内部服务器错误。

ActionView::Template::Error (syntax error on line 14, col 8: `        current_practice_telephone:           "Telephone"'):

我的完整 en.yml 文件

en:
  activerecord:
    attributes:
      user:
        password_digest: "Password"
    credential:
        current_practice_address_line1:     "Address"
        current_practice_address_city:      "City"
        current_practice_address_state:     "State"
        current_practice_address_country:   "Country"
        current_practice_address_zip_code:  "Zip Code"
        current_practice_telephone:         "Telephone"
        NPI_number:                         "Your NPI Number"
        license_number:                     "Your State License Number"
        state_license_website_link:         "Can you provide a link to your state license information? (Optional)"
        current_practice_name:              "Practice Name"
        current_practice_title:             "Your Title"
        current_practice_fellowship:        "Name of your Fellowship"
        current_practice_residency:         "Name of your Residency"
        current_practice_subspecialty:      "Name of your subspecialty"

我真的很困惑为什么heroku服务器会在这里呕吐。有任何想法吗?

更新:我修复了丢失的报价,但 heroku 仍然不会处理 YAML 文件。最近一次更新后:

本地控制台

 YAML.load(File.open('config/locales/en.yml'))
 => {"en"=>{"activerecord"=>{"attributes"=>{"user"=>{"password_digest"=>"Password"}}, "credential"=>{"current_practice_address_line1"=>"Address", "current_practice_address_city"=>"City", "current_practice_address_state"=>"State", "current_practice_address_country"=>"Country", "current_practice_address_zip_code"=>"Zip Code", "current_practice_telephone"=>"Telephone", "NPI_number"=>"Your NPI Number", "license_number"=>"Your State License Number", "state_license_website_link"=>"Can you provide a link to your state license information? (Optional)", "current_practice_name"=>"Practice Name", "current_practice_title"=>"Your Title", "current_practice_fellowship"=>"Name of your Fellowship", "current_practice_residency"=>"Name of your Residency", "current_practice_subspecialty"=>"Name of your subspecialty"}}}} 

heroku 控制台

irb(main):001:0> YAML.load(File.open('config/locales/en.yml'))
ArgumentError: syntax error on line 11, col 8: `        current_practice_telephone:         "Telephone"'
    from /usr/local/lib/ruby/1.9.1/syck.rb:135:in `load'
    from /usr/local/lib/ruby/1.9.1/syck.rb:135:in `load'
    from (irb):1
    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/commands/console.rb:47:in `start'
    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/commands/console.rb:8:in `start'
    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/commands.rb:41:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'
irb(main):002:0> 
4

2 回答 2

2

您在“邮政编码”后缺少报价

但一般来说,当您看到此错误时,是因为您的编辑器已将空格替换为制表符。Yml 取决于缩进的空格。

于 2012-11-17T21:04:52.060 回答
1

You probably have a invisible character on the affected line that causes the problems. Either configure your editor to show invisible characters, or simple delete the line, and type it again.

于 2012-11-18T02:16:39.783 回答