I am using the agnostic branch of will_paginate and version 0.10.1 of DM. In
my code, I do a query like this:

Event.all('member.team_id' => team.id).paginate(:page => 1, :per_page => 10)

This causes the following errant SQL to be emitted using the MySQL adapter:

MySQL error: Not unique table/alias: 'members'


> SELECT `events`.`id`, `events`.`member_id` FROM `events` INNER JOIN
> `members` ON `events`.`member_id` = `members`.`id` INNER JOIN `members` ON
> `events`.`member_id` = `members`.`id` WHERE `members`.`team_id` = 1 AND
> `members`.`team_id` = 1 GROUP BY `events`.`id`, `events`.`member_id` ORDER
> BY `events`.`id` LIMIT 10


Notice that the INNER JOIN is mistakenly repeated. This problem does not
occur in my "normal" queries, and it did not occur in DM 0.9.x.

See this gist for a short Ruby script that demonstrates the issue:

https://gist.github.com/a3fe6d37340512e66861

I have not started digging too deeply into what is causing this yet. I just
thought I would see if anyone here has any ideas what could cause this. I
have cross-posted to the will_paginate list as well. Thanks.

..tony.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"DataMapper" 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/datamapper?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to