The main problem is that your YAML file stores your data as a hash and tries to access it as an array.
To convert your data to an array format:
--- - :title: Some title :description: Some body text maybe - :title: Some title :description: Some body text maybe
It is also interesting to note that you had to use item[1][:title] to link to your items, so the keys 001 and 002 converted to integers by YAML.load.
You can confirm this in irb:
irb(main):015:0> YAML.load(File.open("./test.yml")) => {1=>{:title=>"Some title", :description=>"Some body text maybe"}, 2=>{:title=>"Some title", :description=>"Some body text maybe"}}
Robert Mitchell
source share