Skip to content

Instantly share code, notes, and snippets.

@WizardOfOgz
Created December 19, 2011 22:14
Show Gist options
  • Save WizardOfOgz/1499154 to your computer and use it in GitHub Desktop.
Save WizardOfOgz/1499154 to your computer and use it in GitHub Desktop.
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