Skip to content
Browse files

Fix reordering shuffle that causes 11th+ items to be moved upward in …

…chain.
  • Loading branch information...
1 parent 79043f6 commit 4c8548678ed5c73c413104eff65577575c05081d @robyurkowski robyurkowski committed Aug 14, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 core/lib/refinery/crud.rb
View
2 core/lib/refinery/crud.rb
@@ -269,7 +269,7 @@ def update_positions
# After we drop Ruby 1.8.x support the following line can be changed back to
# list.each do |index, hash|
# because there won't be an ordering issue (see https://github.com/resolve/refinerycms/issues/1585)
- list.sort.map { |item| item[1] }.each_with_index do |hash, index|
+ list.sort_by {|k, v| k.to_i}.map { |item| item[1] }.each_with_index do |hash, index|
moved_item_id = hash['id'].split(/#{singular_name}\_?/).reject(&:empty?).first
@current_#{singular_name} = #{class_name}.find_by_id(moved_item_id)

0 comments on commit 4c85486

Please sign in to comment.
Something went wrong with that request. Please try again.