Rails4: replace deprecated Relation#update_all at acts_as_list
git-svn-id: http://svn.redmine.org/redmine/trunk@12526 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
74ccf34361
commit
78ca50560a
|
@ -137,7 +137,8 @@ module ActiveRecord
|
||||||
def reset_positions_in_list
|
def reset_positions_in_list
|
||||||
acts_as_list_class.where(scope_condition).reorder("#{position_column} ASC, id ASC").each_with_index do |item, i|
|
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)
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue