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 -

java - Jtable duplicate Rows -

java - Run a .jar on Heroku -