[Rails-core] Re: nested includes in AR and to_json / to_xml

2010-06-24 Thread Neeraj Singh
Hi David, This is what I found with rails edge. puts Project.find(2).to_xml(:include => {:tasks => {:include => :users}}) pr2 2010-06-25T03:50:57Z 2010-06-25T03:50:57Z 2 task2 2 2 Peter 2 1 1

[Rails-core] Re: nested includes in AR and to_json / to_xml

2010-06-25 Thread David
Hi Neeraj, could you try puts Project.includes(:tasks => :users).where('tasks.id is not null').to_xml(:include => {:tasks => {:include => :users}}) this will return 3 times the same task (task2). Without the where('tasks.id is not null'), it returns the correct values. The differnce is in the s

[Rails-core] Re: nested includes in AR and to_json / to_xml

2010-06-25 Thread Neeraj Singh
I am able to reproduce this problem. Can you open a ticket so that it's documented. We will have rest of discussion on that ticket. On Jun 25, 5:51 am, David wrote: > Hi Neeraj, > > could you try > > puts Project.includes(:tasks => :users).where('tasks.id is not > null').to_xml(:include => {:tas

[Rails-core] Re: nested includes in AR and to_json / to_xml

2010-06-25 Thread Neeraj Singh
Notice that first one works fine but the second one fails. # works fine puts Project.includes(:tasks).where('tasks.id is not null').to_xml(:include => {:tasks => {:include => :users}}) # causes duplicates puts Project.includes(:tasks => :users).where('tasks.id is not null').to_xml(:include => {:t

[Rails-core] Re: nested includes in AR and to_json / to_xml

2010-06-25 Thread David
Ticket: https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/4971-nested-includes-in-ar-causes-duplicates-in-to_json-to_xml On 25 Jun., 15:51, Neeraj Singh wrote: > Notice that first one works fine but the second one fails. > > # works fine > puts Project.includes(:tasks).where('t