Created
August 13, 2011 13:17
-
-
Save krzysztofjablonski/1143843 to your computer and use it in GitHub Desktop.
bug in datamapper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Transaction | |
include DataMapper::Resource | |
property :user_id, Integer | |
def self.u1 | |
all(:conditions => ["user_id != 4"]) | |
end | |
def self.u2 | |
all(:conditions => ["user_id != 5"]) | |
end | |
def self.u3 | |
all(:conditions => ["user_id != 6"]) | |
end | |
end | |
Console: | |
Transaction.u1.count | |
SQL (0.270ms) SELECT COUNT(*) FROM `transactions` WHERE (user_id != 4) | |
Transaction.u1.u2.count | |
SQL (0.311ms) SELECT COUNT(*) FROM `transactions` WHERE ((user_id != 4) AND (user_id != 5)) | |
Transaction.u1.u2.u3.count | |
SQL (0.312ms) SELECT COUNT(*) FROM `transactions` WHERE ((user_id != 5) AND (user_id != 6)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment