Created
January 26, 2011 22:12
-
-
Save kasima/797594 to your computer and use it in GitHub Desktop.
Mongoid::Matchers.matches? bug
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 Game | |
include Mongoid::Document | |
field :title | |
references_and_referenced_in_many :players | |
end | |
class Player | |
include Mongoid::Document | |
field :name | |
references_many :games | |
end | |
player = Player.new(:name => "Dr. Seuss") | |
game = Game.new(:title, :players => [player]) | |
conditions = {:player_ids => player.id} | |
fetched = Game.where(conditions) | |
fetched.count | |
# => 1 | |
fetched.first.matches? conditions | |
# => false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment