Fix for path renaming
This commit is contained in:
parent
9e9620c04a
commit
a9aa1dd150
|
@ -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
|
||||||
|
|
Reference in New Issue