I have a tables of Users, Carts, Orders and OrderTransactions.
My schema looks like:
I would like to display the user_id in the order transaction partial.
I can display the cart_id with <%= order_transaction.order.cart_id %>
So I thought that <%= order_transaction.order.cart.user_id %>
would work but it's giving a "undefined method `user_id' for nil:NilClass" error.
What am I missing here? Any help would be much appreciated!
Just noticed, It does actually work. I needed to delete all transactions created before the changes I made.