mongoid references_many referenced_in not working rails
I have a problem with referenced_many and referenced_in relation model.
My model is of following. Student references_many mobile_numbers MobileNumber referenced_in StudentNow when i try to do @mobile = MobileNumber.first @mobile.student
It pops error saying Document not found for class Student with id(s) 4c47e74ff1936f05f9000015
And @mobile object has student_id : "4c47e74ff1936f05f9000015" as one of its attribute
Is there any thing wrong with my data or开发者_开发技巧 with my model Thanks
Make sure you're using the latest version of Mongoid. I believe older version used has_many_related
and belongs_to_related
.
精彩评论