I before the current Mongoid version 2.0.2, I was able to do
User.criteria.id( 1234 ) #=> user#1234
But now it throws a no method error. Has this been changed to something else or has it been removed?
Thank you for your input
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Found it, they (mongoid team) did remove the criteria#id selector from the latest version of mongoid. The reason why I don’t use Model.find is because it doesn’t do lazy loading, where criteria#id does. But back to the issue here. They replaced criteria#id with criteria#for_ids
So Model.criteria.for_ids(‘1234’) will work