Hi friends, i''m usgin the edge version because i need eager loading on polymorphic associations support, but i see this: Message.find(:first, :include => :owner) #This generate this query: SQL (0.000072) SET SQL_AUTO_IS_NULL=0 Message Load (0.000389) SELECT * FROM `messages` User Load (0.001070) SELECT * FROM `users` WHERE (users.id IN (1,2)) And this Message.find(:first, :include => :owner, :limit => 1) generate this: Message Load (0.000460) SELECT * FROM `messages` LIMIT 1 User Load (0.000318) SELECT * FROM `users` WHERE (users.id IN (2)) Both querys return me the correct owner of message, but in the first query AR fetch an aditional record, anyboby know why? Thanks. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung
2008-Apr-24 07:56 UTC
Re: Bug in eager loading and polymorphic associations?
Fdavila wrote:> Hi friends, i''m usgin the edge version because i need eager loading on > polymorphic associations support, but i see this: >[snip] Well in the first case it seems to have ignored your :first. It''s probably a bug. Fred --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung
2008-Apr-27 10:50 UTC
Re: Bug in eager loading and polymorphic associations?
Turns out that this was something that has been lurking for a long time. it''s fixed now (http://rails.lighthouseapp.com/projects/8994/changesets/361aaa04ef2f33cb1fe49497c73bc13e6b72addc ) On 24 Apr 2008, at 08:56, Frederick Cheung wrote:> > Fdavila wrote: >> Hi friends, i''m usgin the edge version because i need eager loading >> on >> polymorphic associations support, but i see this: >> > [snip] > > Well in the first case it seems to have ignored your :first. It''s > probably a bug. > > Fred > > > --~--~---------~--~----~------------~-------~--~----~ > You received this message because you are subscribed to the Google > Groups "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > For more options, visit this group at http://groups.google.com/group/rubyonra--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---