Skip to content

Instantly share code, notes, and snippets.

@kasima
Created January 26, 2011 22:12
Show Gist options
  • Save kasima/797594 to your computer and use it in GitHub Desktop.
Save kasima/797594 to your computer and use it in GitHub Desktop.
Mongoid::Matchers.matches? bug
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