From 536790857f77e3f6d181dc34ecd04b74df419827 Mon Sep 17 00:00:00 2001 From: Hagen Schink Date: Fri, 5 Dec 2014 12:08:56 +0100 Subject: [PATCH] Move validation of children to OpenProject core --- .../backlogs/patches/work_package_patch.rb | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/lib/open_project/backlogs/patches/work_package_patch.rb b/lib/open_project/backlogs/patches/work_package_patch.rb index 5ccf471d27..ef7c626802 100644 --- a/lib/open_project/backlogs/patches/work_package_patch.rb +++ b/lib/open_project/backlogs/patches/work_package_patch.rb @@ -68,8 +68,6 @@ module OpenProject::Backlogs::Patches::WorkPackagePatch validates_each :parent_id do |record, attr, value| validate_parent_work_package_relation(record, attr, value) - - validate_children(record, attr, value) #not using validates_associated because the errors are not displayed nicely then end include OpenProject::Backlogs::List @@ -112,18 +110,6 @@ module OpenProject::Backlogs::Patches::WorkPackagePatch def parent_work_package_relationship_spanning_projects?(parent, child) child.is_task? && parent.in_backlogs_type? && parent.project_id != child.project_id end - - def validate_children(work_package, attr, value) - if work_package.in_backlogs_type? - work_package.children.each do |child| - unless child.valid? - child.errors.each do |key, value| - work_package.errors.add(:children, value) - end - end - end - end - end end module InstanceMethods