Updated Items
This commit is contained in:
parent
1a90990311
commit
3938f7df06
|
@ -23,7 +23,7 @@ class Item
|
|||
|
||||
before_destroy :destroy_children
|
||||
after_rearrange :rebuild_path, :if => "parent_id_changed? || name_changed?"
|
||||
after_save :rebuild_children_path, :if => "path_changed?"
|
||||
after_save :rebuild_children_path, :rebuild_parent_path, :if => "path_changed?"
|
||||
|
||||
def enabled_for_lang(lang)
|
||||
enabled_for.include?(lang) rescue false
|
||||
|
@ -92,6 +92,11 @@ class Item
|
|||
end
|
||||
end
|
||||
|
||||
def rebuild_parent_path
|
||||
parent = self.parent
|
||||
parent.descendants_and_self
|
||||
end
|
||||
|
||||
# Enable the validation for parent_id
|
||||
def validates_presence_of_parent_id?
|
||||
true
|
||||
|
|
Reference in New Issue