siddharthgutta / Entree.LegacyServer

SMS-based Order Ahead Platform
https://textentree.com
2 stars 0 forks source link

Fixed method not found error #243

Closed jlmao closed 8 years ago

jlmao commented 8 years ago

@bluejamesbond

mathew-kurian commented 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)?

jlmao commented 8 years ago

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?

mathew-kurian commented 8 years ago

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.