diff --git a/app/seeders/demo_data/work_package_seeder.rb b/app/seeders/demo_data/work_package_seeder.rb index 2cf30007d5..e84b4ee366 100644 --- a/app/seeders/demo_data/work_package_seeder.rb +++ b/app/seeders/demo_data/work_package_seeder.rb @@ -161,9 +161,12 @@ module DemoData def create_relations(attributes) Array(attributes[:relations]).each do |relation| + root_work_package = WorkPackage.find_by!(subject: attributes[:subject]) + to_work_package = WorkPackage.find_by(subject: relation[:to], project: root_work_package.project) + to_work_package = WorkPackage.find_by!(subject: relation[:to]) unless to_work_package.nil? create_relation( - to: WorkPackage.find_by!(subject: relation[:to]), - from: WorkPackage.find_by!(subject: attributes[:subject]), + to: to_work_package, + from: root_work_package, type: relation[:type] ) end