ruby on rails - Can I convert model with one of its associations to YAML format? -


i want print activerecord model in yaml format debugging purposes.

currently invoke model.to_yaml. doesn't return model's associations

how can convert model 1 of associations yaml format?

you can convert json first. default activerecord as_json method allows include assocations. there, it's straightforward convert yaml. example:

menu.as_json(include: :dishes).to_yaml 

Comments

Popular posts from this blog

Line ending issue with Mercurial or Visual Studio -

tags - Jquery Mixitup plugin help prevent handlers being destroyed -

c# - Delving into the world of XML (Windows Phone) Error I dont understand (The ' ' character, hexadecimal value 0x20, cannot be included in a name.) -