I have a 3 level Models structure:
-
Model_Race has_many Model_Class
-
Model_Class has_many Model_Driver
Now, imagine Model_Class and Model_Driver have an order_index property to keep them in order.
Is there a clean way to get a Race and have the Class and Driver’s sorted correctly?
The documentation clearly shows this, I somehow missed it:
Find Array Syntax
Using Query Method Chaining Syntax
(my preferred method over array syntax above)
Build it into the Model
You can set up the relationships in the model so that this happens by default:
Race Model:
Class Model: