mongoid/mongoid — Issue #1408: Problem with embedded documents and find
Author: eatcpcks
Created: 2011-11-03 20:43:02+00:00
State: open

When I try to find a document embedded in another I get the document not found for class error...
But as you can see, the id is correct...
```
irb(main):014:0> puts @page.blocks.each{ |block| puts block.id}
4eb2cb6a4403e20009000006
#
=> nil
irb(main):015:0> puts @page.blocks.find("4eb2cb6a4403e20009000006")
Mongoid::Errors::DocumentNotFound: Document not found for class Block with id(s) 4eb2cb6a4403e20009000006.
from /app/vendor/bundle/ruby/1.9.1/gems/mongoid-2.3.3/lib/mongoid/criterion/inclusion.rb:151:in `block in execute_or_raise'
from /app/vendor/bundle/ruby/1.9.1/gems/mongoid-2.3.3/lib/mongoid/criterion/inclusion.rb:149:in `tap'
from /app/vendor/bundle/ruby/1.9.1/gems/mongoid-2.3.3/lib/mongoid/criterion/inclusion.rb:149:in `execute_or_raise'
from /app/vendor/bundle/ruby/1.9.1/gems/mongoid-2.3.3/lib/mongoid/criterion/inclusion.rb:129:in `find'
from /app/vendor/bundle/ruby/1.9.1/gems/mongoid-2.3.3/lib/mongoid/relations/embedded/many.rb:208:in `find'
from (irb):15
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.1.1/lib/rails/commands/console.rb:45:in `start'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.1.1/lib/rails/commands/console.rb:8:in `start'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.1.1/lib/rails/commands.rb:40:in `'
from script/rails:6:in `require'
from script/rails:6:in `

'
```
I don't know if it's related to the fact that i'm using inheritance?