Probably a stupid question but I'm relatively new to Rails and wondering how Rails handles serializing a model that has_many (and/or belongs_to) objects of another class. Will it serialize the whole object graph by default? Do you, necessarily, want that? Can you control it? How?
Any tricks on the receiving end regarding how to de-serialize it? or pretty much brute force assign properties to their hash value and any embedded arrays/hashes would then become associated class objects?
Edit: Adding example of json returned using @zetetic's example. Wondering why embedded collection (grommets) have escape(\
) characters before each quote("
)?
{"name":"Gizmo","height":15,"grommets":"[{\"name\":\"Sid\",\"color\":\"yellow\"},{\"name\":\"Elvis\",\"color\":\"\"},{\"name\":\"Teeny\",\"color\":\"Red\"}