I have a Rhodes (RhoMobile) PropertyBag Model that I would like to convert to JSON string. I tried @model_instance.to_json but it does not appear that method exists. I would like to then take the JSON string and submit it to a RESTful service. Any assistance is much appreciated. Thank you.
Asked
Active
Viewed 397 times
2 Answers
0
I think first of all you need to convert the model to meta data, Meta data is defined in a source adapter by implementing an adapter method metadata
that returns a JSON structure. then you can use yourmodelname.metadata('foo' => 'bar' }.to_json
then it will convert your database into json. This is basically done with FixedSchema, not sure about the PropertyBag.

uday
- 8,544
- 4
- 30
- 54
-
Thank you, Dave. I appreciate the response. I found the solution on my own. Please see my answer. – Amir Khawaja Jan 11 '12 at 23:12
0
I feel so silly. I did not realize the json gem is not automatically included. All I had to do was require 'json' at the top of the controller file and call @model_name.to_json. I hope this helps someone else.

Amir Khawaja
- 459
- 1
- 6
- 13