Skip to content

Instantly share code, notes, and snippets.

@npverni
Created March 31, 2010 21:50
Show Gist options
  • Select an option

  • Save npverni/350957 to your computer and use it in GitHub Desktop.

Select an option

Save npverni/350957 to your computer and use it in GitHub Desktop.
#
# Is there a way to override the root name for as_json or to_json?
#
Book.first.to_json
#=> "{\"book\":{\"created_at\":\"2010-03-23
Book.first.to_json(:root => 'libro') # is there an option like this?
#=> "{\"libro\":{\"created_at\":\"2010-03-23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment