我正在尝试使用我的 Rails (3.2.7) 应用程序解析以下 YAML
---
main-menu:
- mitem: Test1
controller: user
action: test
- mitem: Test
controller: user
action: test2
- mitem: Test3
controller: user
action: test
不幸的是,当我加载我的文件时
require "yaml"
@menu = YAML.load_file(file)
我收到一个错误
Psych::SyntaxError in User#test
Showing /srv/http/fiss/app/views/layouts/application.html.haml where line #12 raised:
(/srv/http/fiss/app/assets/yaml/menu.yaml): did not find expected key while parsing a block mapping at line 6 column 5
我是 Rails(和 YAML)的新手,但是我已经用YAML Lint检查了代码,显然 YAML 代码是有效的。这是什么原因造成的?