This project is archived and is in readonly mode.
default scoping and associations
-
CancelProfileIsBroken
- Tag changed from activerecord to activerecord, bugmash
-
dira
+1 - applying the conditions of the scope is clearly a bug
verified
-
dira
I've attached a patch. This test applies on master and shows the bug.
-
William Gray
find_each doesn't just have this problem when used with a scope, it adds any :conditions used to called associations, like so:
User.find_each(:conditions => {:sex => 'male'}) do |user| p user.female.friends endthis would also return nothing, as the condition :sex => 'male' gets added to the call to user.female.friends.
-
Daniel Guettler
- Tag changed from activerecord, bugmash to activerecord, bugmash, patch, tests
The attached patch contains the tests Dira added plus the changes needed to make it pass. Basically it adds an empty hash to the scoped_methods before yielding records and removes it again after the yield.
-
Matt Jones
- State changed from new to duplicate
