Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After updating a foreign key, the result data does not include the updated data #77

Open
danieldilly opened this issue Apr 6, 2021 · 0 comments

Comments

@danieldilly
Copy link

Suppose you have 2 tables: cars and brands and each car has an association to brand

After updating a car's brand (setting brandId), and if the brand model is associated in the finale resource() method, the result will show the updated brandId value but the brand object on the model will still show the previous value.

Let's say we have a car that looks like this: { id: 3, name: 'First car', brandId: 7 }
When we fetch it, it includes the brand: { id: 3, name: 'First car', brandId: 7, Brand: { id: 7, name: 'Oldsmobile' } }

Now, if we update brandId to 4, the result will be: { id: 3, name: 'First car', brandId: 4, Brand: { id: 7, name: 'Oldsmobile' } }

The Brand associated object still shows the old data until the next fetch.

@danieldilly danieldilly changed the title After updating an a foreign key, the result data does not include the updated data After updating a foreign key, the result data does not include the updated data Apr 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant