chuyeow
2007-Sep-25 16:27 UTC
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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
chuyeow
2007-Sep-26 04:31 UTC
Re: Patch review requested for #9677: Add :include to ActiveRecord::Base#to_json
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 On Sep 26, 12:27 am, chuyeow <chuy...@gmail.com> wrote:> 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--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---