-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Drew Proebstel
committed
Feb 25, 2025
1 parent
44287ed
commit 1a8bf33
Showing
7 changed files
with
398 additions
and
244 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
namespace :state_file do | ||
desc "Populate fake addresses for existing StateFileArchivedIntake records" | ||
task populate_fake_addresses: :environment do | ||
missing_addresses = StateFileArchivedIntake.where(fake_address_1: nil).or(StateFileArchivedIntake.where(fake_address_2: nil)) | ||
|
||
if missing_addresses.any? | ||
puts "Updating #{missing_addresses.count} records with fake addresses..." | ||
|
||
missing_addresses.find_each do |intake| | ||
intake.send(:populate_fake_addresses) # Calls private method | ||
if intake.save | ||
puts "Updated intake ID #{intake.id}" | ||
else | ||
puts "Failed to update intake ID #{intake.id}: #{intake.errors.full_messages.join(', ')}" | ||
end | ||
end | ||
|
||
puts "Fake address population complete." | ||
else | ||
puts "No records need updating." | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.