We'll respond shortly.
If you are overriding
to_json in any of your Rails models you should read Jonathan Julian’s blog post which explains the purpose of
Enter ActiveSupport 2.3.3. Now the creation of the json is separate from therendering of the json. as_json is used to create the structure of the JSON as a Hash, and the rendering of that hash into a JSON string is left up to ActiveSupport::json.encode. You should never use to_json to create a representation, only to consume the representation.
as_json is also easier to test because it returns a Ruby
Hash instead of a