mongoid/mongoid — pull request #1709 by robinst (2012-02-12 18:37:56+00:00)
Title: Allow reordering of foreign keys even with pulls/pushes

When there were pushes (or pulls) as well as elements being reordered,
save would only push (or pull) elements. The changed order of the other
elements were lost.

With this change, checking is done to ensure that we only push when the
new elements are at the end, and pull when the remaining element's order
has not changed.

Noticed that this behavior was not quite right when looking at the fix for
mongoid/mongoid#1705.