On Rails 3.1 with Mongoid 2.4, BSON 1.5
I am having trouble finding a model by :_id using Mongoid’s Model.find
Using where:
>> Athlete.where(:_id => BSON::ObjectId.from_string('4f2b22d70f67e90001001edd')).first
=> #<Athlete _id: 4f2b22d70f67e90001001edd, ...>
Using find:
>> Athlete.find('4f2b22d70f67e90001001edd')
=> nil
Any idea what I did wrong?
You need to manually build your mongoid indexes: