Psych vs. Syck¶
Ruby has two common YAML parsers: psych and syck. Psych is newer and faster; syck is venerable but unmaintained. If you run into YAML parsing errors, chances are it is a difference between syck and psych. In MRI ruby 1.9.x, you can revert to the syck parser by setting YAML::ENGINE.yamler = ‘syck’; this is not an option in 1.8.7. You can read more about the syck vs psych problem in our blog.
If you’re running into the YAML parsing problem with the i18n gem, chances are that you have a reference (*section directive) before its definition and are trying to parse the YAML with Psych. Typically, migrations will fail to run and you will see an error message containing the string:
"in `merge!': can't convert nil into Hash (TypeError)"
The simplest solution is to re-order the sections to avoid this problem. You can read more about the issue here.
If you run into parsing problems while using the VCR gem, see our VCR help article.
Happily, as of Ruby 2.0, the Syck YAML engine is not included in the language runtime at all.