I have two related tables: groups and categories. In the models,
Group
has_many “categories”
Category
belongs_to :group
Category does have a column, “group_id” as required.
Both the groups and categories tables have a “sortorder” column which
dictates the order the items are to be presented.
In my controller, I want to retrieve the Categories along with the
information on the Group it belongs to. They should be retrieved in
sortorder sequence with group having the highest precedence.
How can I specify a find statement with an :order_by that specifies both
Group.sortorder and Category.sortorder?