Much faster sort method for use with sorted and acts_as_list gems.

This needs testing!


def moved_id(ids)
  moved_candidate(ids, first_changed_index(ids))
end

def moved_candidate(ids, offset)
  delta(ids, ids[offset]) > delta(ids, original_ids[offset]) ? ids[offset] : original_ids[offset]
end

def delta(ids, candidate)
  (ids.index(candidate) - original_ids.index(candidate)).abs
end