开发者

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 Student

Now 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜