Skip to content
This repository has been archived by the owner on Mar 30, 2022. It is now read-only.

AREL merge (&) causes redundant joins #42

Open
nikhilgupte opened this issue Dec 2, 2011 · 0 comments
Open

AREL merge (&) causes redundant joins #42

nikhilgupte opened this issue Dec 2, 2011 · 0 comments

Comments

@nikhilgupte
Copy link

Without meta_where:

> (UserVote.joins(:user) & User.verified).to_sql
=> "SELECT `votes`.* FROM `votes` INNER JOIN `users` ON `users`.`id` = `votes`.`user_id` WHERE `votes`.`type` = 'UserVote' AND (verified_at is not null)"

With meta_where:

> (UserVote.joins(:user) & User.verified).to_sql
=> "SELECT `votes`.* FROM `votes` INNER JOIN `users` ON `users`.`id` = `votes`.`user_id` INNER JOIN `users` `voting_users_votes` ON `voting_users_votes`.`id` = `votes`.`user_id` WHERE `votes`.`type` = 'UserVote' AND (verified_at is not null)"
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant