How to use to_yaml method in Rails, and remove '---' -
i'm trying generate hash in yaml format, default, method adds --- in front of object.
> h = {key1: 'v1', key2: 'v2'} => {:key1=>"v1", :key2=>"v2"} > h.deep_stringify_keys.to_yaml => "---\n:key1: v1\n:key2: v2\n"
brute force, it'll trick:
h.deep_stringify_keys.to_yaml[3..-1]
Comments
Post a Comment