Folks,
I have a Meal model and Model.find(:all).to_json returns the following
[{"meal": {"name": "Veggies Lasagna", "id": 1}}, {"meal": {"name": "Chicken Rice", "id": 2}}, {"meal": {"name": "Noodle Rice", "id": 3}}]
What I want to do is not have the table name (meal) be part of the output json string i.e. what I want it to output is
[ {"name": "Veggies Lasagna", "id": 1}, {"name": "Chicken Rice", "id": 2}, {"name": "Noodle Rice", "id": 3}]
Any way I can do this? I looked at to_json input options which seem to let you control the columns that are output but apparently not the table name.
If you are wondering why I need JSON output in this format, that is because I want to consume this output from dojo.data.ItemFileReadStore
Thanks for any pointers/help.
-S