]> source.dussan.org Git - redmine.git/commitdiff
Rails4: replace deprecated Relation#update_all at acts_as_list
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Wed, 8 Jan 2014 10:11:16 +0000 (10:11 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Wed, 8 Jan 2014 10:11:16 +0000 (10:11 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@12526 e93f8b46-1217-0410-a6f0-8f06a7374b81

lib/plugins/acts_as_list/lib/active_record/acts/list.rb

index 3c1ba5216557e80dba4a68e8c83868ce1d56ed1d..f1887eed4b5d8bfac6e41b0332a69562129681b0 100644 (file)
@@ -137,7 +137,8 @@ module ActiveRecord
         def reset_positions_in_list
           acts_as_list_class.where(scope_condition).reorder("#{position_column} ASC, id ASC").each_with_index do |item, i|
             unless item.send(position_column) == (i + 1)
-              acts_as_list_class.update_all({position_column => (i + 1)}, {:id => item.id})
+              acts_as_list_class.where({:id => item.id}).
+                update_all({position_column => (i + 1)})
             end
           end
         end