Created
December 19, 2011 22:14
-
-
Save WizardOfOgz/1499154 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Foo | |
has_many :bars | |
def to_json | |
bars_json = bars.map(&:to_json).join(",") | |
%Q({"foo": {...{"bars": [#{bars_json}] } } }) | |
end | |
end | |
class Bar | |
belongs_to :foo | |
def to_json | |
... | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment