Patch review requested for #9677: Add :include to ActiveRecord::Base#to_json

Simple patch really, that adds :include option to ActiveRecord::Base#to_json like for ActiveRecord::Base#to_xml:

http://dev.rubyonrails.org/ticket/9677

Allows you to do:

json = @david.to_json(:include => :posts) # or even... json = @david.to_json(   :include => {     :posts => {       :include => {         :taggings => {           :include => {             :tag => { :only => :name }           }         }       }     } })

Please use the 2nd diff (http://dev.rubyonrails.org/attachment/ticket/ 9677/add_includes_to_to_json.2.diff) - I forgot to replace the existing diff when uploading a small fix.

Thanks!

Cheers, Chu Yeow

I've put up a new patch (see http://dev.rubyonrails.org/ticket/9677) on David's suggestion to move add_includes up into the Serializer superclass. Please help test. Thanks!

Cheers, Chu Yeow