Skip to content

Instantly share code, notes, and snippets.

@WizardOfOgz
Created December 19, 2011 22:14
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
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