ForestAdmin / forest-express-sequelize

🌱 Express/Sequelize agent for Forest Admin to integrate directly to your existing Express/Sequelize backend application.
https://www.forestadmin.com
GNU General Public License v3.0
191 stars 48 forks source link

Failure to update relationship #319

Closed idahogurl closed 5 years ago

idahogurl commented 5 years ago

I try to update a member's state and no changes are made.

Expected behavior

The relationship changes to the selected value.

Actual behavior

No changes are made.

Context

There are only SELECT statements no UPDATE image

Network Panel from request is sending the right id (80 = Punjab, Pakistan) image

Video showing steps https://youtu.be/uaFOvigauCg

Zip of my Models https://www.icloud.com/iclouddrive/0NawNHQCPitC0cdoh91KjEWeQ#models

arnaudbesnier commented 5 years ago

Hi @idahogurl ,

It looks to be a configuration issue of your Sequelize members model. A member should belongsTo a state and a country (instead of hasOne). If I am right, this is not an issue of the Forest Liana, but a bad configuration on your side.

idahogurl commented 5 years ago

@arnaudbesnier I have tried belongsTo. Still is not working.

idahogurl commented 5 years ago

@arnaudbesnier The trick was that I needed to specify foreignKey = "stateId" and targetKey = "id" as well as changing to belongsTo. That would be good to add to your documentation.