Fix for path renaming

This commit is contained in:
chris 2013-02-18 18:21:33 +08:00
parent 9e9620c04a
commit a9aa1dd150
1 changed files with 1 additions and 1 deletions

View File

@ -23,6 +23,7 @@ class Item
before_destroy :destroy_children before_destroy :destroy_children
after_rearrange :rebuild_path, :if => "parent_id_changed? || name_changed?" after_rearrange :rebuild_path, :if => "parent_id_changed? || name_changed?"
after_save :rebuild_children_path, :if => "path_changed?"
def enabled_for_lang(lang) def enabled_for_lang(lang)
enabled_for.include?(lang) enabled_for.include?(lang)
@ -68,7 +69,6 @@ class Item
def rebuild_path def rebuild_path
self.path = (self.ancestors_and_self - [Item.root]).collect{|x| x.name unless x.root?}.join('/') self.path = (self.ancestors_and_self - [Item.root]).collect{|x| x.name unless x.root?}.join('/')
self.rebuild_children_path
end end
def rebuild_children_path def rebuild_children_path