Here’s an somewhat unconventional approach to drag and drop sorting using acts_as_list I came up with this week. In the old days, I would have implemented something similar to this RailsCasts episode. But I think I might like this better.
acts_as_list
I made a YouTube video explaining my thinking.
As Chris Oliver notes, it’s probably best to use Signed Global IDs to avoid users tampering with model names and IDs.
<%= link_to [:edit, page], class: "sortable-draggable", data: { sortable_target: "item", sortable_gid: page.to_global_id.to_s } do %> <%= page.name %> <% end %>