From 2d4ba042f9c88aed00b1216ec535115a822e436e Mon Sep 17 00:00:00 2001 From: Liam Morley Date: Thu, 14 Oct 2021 15:39:54 -0400 Subject: [PATCH] Call update_all on a relation, not 'update' which exists on a model --- lib/tasks/one_off.rake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/tasks/one_off.rake b/lib/tasks/one_off.rake index 7465046f..5fce6b62 100644 --- a/lib/tasks/one_off.rake +++ b/lib/tasks/one_off.rake @@ -4,8 +4,8 @@ namespace :one_off do combined_school.update qualtrics_code: 5 full_circle = School.find_by_name 'Full Circle High School' next_wave = School.find_by_name 'Next Wave Junior High School' - SurveyItemResponse.where(school: [full_circle, next_wave]).update! school: combined_school - full_circle.destroy - next_wave.destroy + SurveyItemResponse.where(school: [full_circle, next_wave]).update_all school_id: combined_school.id + full_circle.destroy! + next_wave.destroy! end end