Say I have a model called Order. Can I specify that an order “:has_many
That is, an order has many other orders associated with it.
I’m trying to do this, but I’m getting an error saying “undefined method
order.” Is there a join table that I need to create?
Thanks in advance.
Hi Mariko C.
If you are writing code in Order model then
:has_many orders, seems to be an erronotical logic.
if you have more then one item in a single order then u have to write
(here ordered_items is a table which linked with orders table and having
fields like id, order_id, item_id, etc.)
B’coz logically an Order doesn’t have many orders, it should be
order_items or so.
Try this, hope you will find it helpful.