Closed jlmao closed 8 years ago
So, don't use order.User.<attribute>
because order.User
is actually populated by a join done by sequelize and I am not not sure where that join is being done. So, something like: const user = Order.findUser(order.id)
?
What does not knowing where the join is being done affect using it or not? Like in some cases that field might not be populated?
The order.User
attribute is only available when you do a query like this with sequelize: Order.findOne({id, include: [{model: User}]})
. So, if this is not done, then the Order.User
attribute won't exist I believe. So, I don't see where this is being done in the code so it might be that sequelize is just doing it internally at some point which I can't seem to predict.
@bluejamesbond