问题
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.
回答1:
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.
回答2:
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'
回答3:
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.
来源:https://stackoverflow.com/questions/15406670/after-upgrading-to-rails-3-2-i-see-activerecordfixtureformaterror-a-yaml-er