Skip to content

Instantly share code, notes, and snippets.

@mlangenberg
Created September 26, 2014 19:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mlangenberg/6c7319768616251b9886 to your computer and use it in GitHub Desktop.
Save mlangenberg/6c7319768616251b9886 to your computer and use it in GitHub Desktop.
gem 'json', '1.8.1'
require 'json'
class FooBar
def as_json(options = nil)
{ foo: 'bar' }
end
end
puts JSON.generate(FooBar.new, quirks_mode: true)
gem 'rails', '4.0.10'
require 'rails/all'
puts JSON.generate(FooBar.new, quirks_mode: true)
# OUTPUT:
# => "#<FooBar:0x007fa1aa841478>"
# => {"foo":"bar"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment