I recently had a need to dump a data structure to yaml so that a user can modify some data, push the files up to a server and quickly bring them into an application. One developer ran the data dump on his machine, and then I ran the code to import it on mine. We were using the same codebase and same gemset with Ruby 1.9.2. I expected to get a nice import of the data and to be on my merry way. Instead I got a parse error.
After digging a bit I ran into these posts that talk the entire story.
So what was the problem? The user than ran the dump did not have the libyaml libraries installed on their system so rails fell back to using syck. This is not ideal. Personally I think that rails should just include the psych gem and require and explicit setting to drop back to syck. That way things work the same across environments. Maybe there is a reason for having things the other way, but in the meantime if you want to make sure that your yaml works the same across environments add a
to your Gemfile.
This was an issue because we were using Ruby 1.9.2 where psych is an optional package. If you are using Ruby 1.9.3 psych is always included.