0

I see the following error after upgrading to rails 3.2.12 with ruby 1.9.2.

ActiveRecord::Fixture::FormatError: a YAML error occurred parsing /SampelRails/user_properties.yml. Please note that YAML must be consistently indented using spaces. Tabs are not allowed. Please have a look at http://www.yaml.org/faq.html The exact error was: Psych::SyntaxError: couldn't parse YAML at line 1 column 0

I have doubled checked the yml files and they seem to be indented properly.

according to https://github.com/rails/rails/issues/2731 this issue seem to be fixed in rails 3.1.1.

Giridhar Bandi
  • 1,313
  • 1
  • 11
  • 28
  • If you just switched to 1.9.2: in 1.9.2. the YAML parser has changed, so that could explain it. Secondly, strings are by default utf-8, so that could also have an effect if you have some special (e.g. accented) characters in your YAML. But to be certain, it would help to see the smallest YAML file that gives you the error. – nathanvda Mar 14 '13 at 10:40
  • Also see http://stackoverflow.com/questions/5843104/rails-3-couldnt-parse-yaml?rq=1 – nathanvda Mar 14 '13 at 10:42
  • tnx for the response .. the solution worked. – Giridhar Bandi Mar 14 '13 at 11:04

3 Answers3

3

just experienced the same issue but the problem was that i was saving my VCR cassettes in test/fixtures/vcr_cassettes/*.yml.
ActiveRecord::Fixture gets confused by yml files with content other than AR fixture data.

glasz
  • 2,526
  • 25
  • 24
0

The link posted by nathanvda really worked.

Try adding this at the beginning of config/boot.rb

require 'yaml'
YAML::ENGINE.yamler= 'syck'

Rails 3 - 'Couldn't parse Yaml'

Community
  • 1
  • 1
Giridhar Bandi
  • 1,313
  • 1
  • 11
  • 28
0

I just had the same issue. Solved it by removing a dummy fixture file from fixtures directory. That file had nothing but comments in it.

Mika
  • 1,419
  • 18
  • 37