What does the _related add to a relation? For example what is the difference between belongs_to and belongs_to_related? I’m mostly seeing this in Mongoid apps but not sure if it applies to Rails in general as well.
Share
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.
belongs_to_related represents a relational association to a “parent” object.
please check this issue and the example given here on GitHub:
https://github.com/mongoid/mongoid/issues/348
See also:
http://rubydoc.info/gems/mongoid-with-auth/1.9.4/Mongoid/Associations/BelongsToRelated
has_many_related represents a relational one-to-many association with an object in a separate collection or database.
See also:
http://rubydoc.info/gems/mongoid-rails2/1.9.4/Mongoid/Associations/HasManyRelated
http://groups.google.com/group/mongoid/browse_thread/thread/29133cb1691e7db2/7d973df673861264