Rails not parsing a valid YAML file

Viewed 20454

I'm trying to parse the following YAML with my Rails (3.2.7) application

---
main-menu:
  - mitem: Test1
    controller: user
    action: test
  - mitem: Test
    controller: user
    action: test2
    - mitem: Test3
      controller: user
      action: test

Unfortunately straight when I load my file

    require "yaml"
    @menu = YAML.load_file(file)

I get an error

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

I'm new to Rails (and YAML), however I have checked the code with YAML Lint and apparently the YAML code is valid. What's causes this?

4 Answers
Related