Methods that return nil should not be considered YAML; backport of https://github.com/jaw6/rails/commit/7448ec09899d147bccd8a790ad2b29f7ec8d8c53