I think here you need to ask what record's primaryKey is. Otherwise you are asking yourself what the primary key of the record is. and it just happens to work out in the test, if both your and childs primary keys are 'id'