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.
Suppose you have 2 tables:
cars
andbrands
and eachcar
has an association tobrand
After updating a car's brand (setting
brandId
), and if thebrand
model is associated in the finale resource() method, the result will show the updatedbrandId
value but thebrand
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 thebrand
:{ id: 3, name: 'First car', brandId: 7, Brand: { id: 7, name: 'Oldsmobile' } }
Now, if we update
brandId
to4
, 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.