Fix bugs for shift_to and change items.rake for the missing position in db

This commit is contained in:
Christophe Vilayphiou committed 2012-05-11 17:56:26 +08:00
1 parent 6a443f0976
commit 17b486f9e9
3 files changed
+20 -1

No files matched your search

+1 -1
View File
@@ -3,7 +3,7 @@
namespace :items do
task :tree_changes => :environment do
Item.all.each do |item|
item.position -= 1
item.position -= item.position > 5 ? 2 : 1
item.parent_ids = ancestors(item)
item.rename(:full_name, :path)
item.save