Open benswinburne opened 4 years ago
Sorry about the delayed response! I'm behind on issues a bit due to some consulting/training work.
In this case you would need to add the fixture data on both sides. So, you would need to add campaignIds
to the creative
fixtures.
Alternatively you could use seeds()
hook and use the schema methods, in which case Mirage will take care of some of the bookkeeping for you:
seeds(server) {
let c1 = server.create("creative", attrs);
let c2 = server.create("creative", attrs);
server.create("campaign", { name: "example", creatives: [c1, c2] });
}
or, if you really wanted to use hard-coded ids for some reason (or had them from somewhere else),
seeds(server) {
let c1 = server.create("creative", {
id: "3fd34999-9519-42b0-8f08-1c2dfea8d338",
...otherAttrs
});
let c2 = server.create("creative", {
id: "247c689a-8834-4b64-a052-b73228bdb407",
...othetrAttrs
});
server.create("campaign", {
name: "example",
creativeIds: [
"3fd34999-9519-42b0-8f08-1c2dfea8d338",
"247c689a-8834-4b64-a052-b73228bdb407"
]
});
}
This may not be a bug, but the example in the docs
I have a many to many relationship
And some fixtures
When querying the campaigns, I can see the two creatives, but when querying the creatives, I can't see the campaigns. Is this expected behaviour or a bug?