@@ -29,13 +29,13 @@ namespace :for_education do
2929
3030 # Destroy the project and then the lesson itself (The lesson's `before_destroy` prevents us using destroy)
3131 lesson_ids = Lesson . where ( school_id :) . pluck ( :id )
32- Project . where ( lesson_id : [ lesson_ids ] ) . destroy_all
33- Lesson . where ( id : [ lesson_ids ] ) . delete_all
32+ Project . where ( lesson_id : lesson_ids ) . destroy_all
33+ Lesson . where ( id : lesson_ids ) . delete_all
3434
3535 # Destroy the class members and then the class itself
3636 school_class_ids = SchoolClass . where ( school_id :) . pluck ( :id )
37- ClassStudent . where ( school_class_id : [ school_class_ids ] ) . destroy_all
38- SchoolClass . where ( id : [ school_class_ids ] ) . destroy_all
37+ ClassStudent . where ( school_class_id : school_class_ids ) . destroy_all
38+ SchoolClass . where ( id : school_class_ids ) . destroy_all
3939
4040 # Destroy the school
4141 School . where ( id : school_id ) . destroy_all
@@ -46,9 +46,9 @@ namespace :for_education do
4646
4747 desc 'Create an unverified school'
4848 task seed_an_unverified_school : :environment do
49- if School . find_by ( code : TEST_SCHOOL )
50- puts "Test school (#{ TEST_SCHOOL } ) already exists, run the destroy_seed_data task to start over) ."
51- return
49+ if School . exists? ( id : TEST_SCHOOL )
50+ puts "Test school (#{ TEST_SCHOOL } ) already exists, run the destroy_seed_data task to start over."
51+ next
5252 end
5353
5454 ActiveRecord ::Base . transaction do
@@ -62,9 +62,9 @@ namespace :for_education do
6262
6363 desc 'Create a verified school'
6464 task seed_a_verified_school : :environment do
65- if School . find_by ( code : TEST_SCHOOL )
66- puts "Test school (#{ TEST_SCHOOL } ) already exists, run the destroy_seed_data task to start over) ."
67- return
65+ if School . exists? ( id : TEST_SCHOOL )
66+ puts "Test school (#{ TEST_SCHOOL } ) already exists, run the destroy_seed_data task to start over."
67+ next
6868 end
6969
7070 ActiveRecord ::Base . transaction do
@@ -79,9 +79,9 @@ namespace :for_education do
7979
8080 desc 'Create a school with lessons and students'
8181 task seed_a_school_with_lessons_and_students : :environment do
82- if School . find_by ( code : TEST_SCHOOL )
83- puts "Test school (#{ TEST_SCHOOL } ) already exists, run the destroy_seed_data task to start over) ."
84- return
82+ if School . exists? ( id : TEST_SCHOOL )
83+ puts "Test school (#{ TEST_SCHOOL } ) already exists, run the destroy_seed_data task to start over."
84+ next
8585 end
8686
8787 ActiveRecord ::Base . transaction do
0 commit comments