@kaspernj/api-maker 1.0.428 → 1.0.429
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -83,7 +83,15 @@ export default memo(shapeComponent(class ApiMakerSuperAdminShowPage extends Base
|
|
|
83
83
|
if (nameAttribute && !select[reflectionModelClassName].includes("name")) select[reflectionModelClassName].push("name")
|
|
84
84
|
|
|
85
85
|
// The foreign key is needed to look up any belongs-to-relationships
|
|
86
|
-
if (!modelClassSelect.includes(reflection.foreignKey()))
|
|
86
|
+
if (!modelClassSelect.includes(reflection.foreignKey())) {
|
|
87
|
+
const foreignKeyAttribute = reflectionModelClassAttributes.find((attribute) => attribute.name() == reflection.foreignKey())
|
|
88
|
+
|
|
89
|
+
if (!foreignKeyAttribute) {
|
|
90
|
+
throw new Error(`${reflection.foreignKey()} wasn't defined as an attribute on ${modelClassName}`)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
modelClassSelect.push(reflection.foreignKey())
|
|
94
|
+
}
|
|
87
95
|
} else if (reflection.macro() == "has_one") {
|
|
88
96
|
const reflectionModelClass = reflection.modelClass()
|
|
89
97
|
const reflectionModelClassName = reflectionModelClass.modelClassData().name
|