I am just starting a new Rails 3 project using Mongoid ORM for MongoDB. There is only one thing that I can’t figure out and interact with so many effectively. Now there are good chances that I may be misplacing this problem, but as far as I know, there are at least two containers in my project that need many-to-many relationships. I would prefer to consider both models as “first class” models and select each with its own container.
This is the easiest way I can structure many-to-many relationships:
{
app: {
_id: "app1",
name: "A",
event_ids: ["event1","event2"]
}
}
{
app: {
_id: "app2",
name: "B",
event_ids: ["event1"]
}
}
{
event: {
_id: "event1",
name: "Event 1",
}
}
{
event: {
_id: "event2",
name: "Event 2",
}
}
, , " ". , , , . post commit/save hooks Event App.event_ids, .
? - - " ", .