enRai
enRai

Reputation: 681

Difference between embeds_many and has_many in mongoid

Can anyone explain to me the difference between embeds_many and has_many in mongoid?

Upvotes: 42

Views: 10290

Answers (1)

Hck
Hck

Reputation: 9167

embeds_many is used to store relative documents inside of parent document.

has_many is used to store a relation between documents in separate collections. Relative records of has_many have field that stores id of the parent document.

Upvotes: 66

Related Questions