Sorting Polymorphic Associations


Recently, I converted a single table inheritance design over to
polymorphic associations as that made a lot more sense from a database
perspective. One of the features of the ui, a drag and dropable list of
items, needs to be completely reworked though.

Instead of having one table with a “sort” column, I have 1 polymorphic
table “items” acting as a pointer to 3 or 4 other tables. This makes
the design of the drag and drop sort a lot more troublesome.

I was previously sorting the results of my find based on the “sort”
column. Now I am using a collect to gather all the associations of
“item” and I’m baffled how to implement this one.

Any ideas as to how I would tackle this?