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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to