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

codeigniter - Fatal error: Call to undefined function lang() in CI Merchant using CardSave -

javascript - CasperJS/PhantomJS failing SSL handshakes on some sites even with --ssl-protocol=any -

python - Received unregistered task using Celery with Django -