LG-11737 Removing providers without integrations#10110
Conversation
…when removing providers without integrations
lib/cleanup/destroyable_records.rb
Outdated
| integration_usages.each do |integration_usage| | ||
| integration_usage.destroy! | ||
| end |
There was a problem hiding this comment.
what if we did this in one pass?
| integration_usages.each do |integration_usage| | |
| integration_usage.destroy! | |
| end | |
| integration_usages.destroy_all |
There was a problem hiding this comment.
its possible for integration_usages to be an empty array
There was a problem hiding this comment.
looks like this PR undid that by removing the || []
There was a problem hiding this comment.
okay yes you're right, I added another test for integrations with no integration usages because it looked as though it was returning an empty array in that case even without that bit of code but the test still passed with destroy_all so I think we're good
There was a problem hiding this comment.
I removed the || [] because Integration has_many integration_usages and rails makes that an empty array automatically - see source code
Sgtpluck
left a comment
There was a problem hiding this comment.
small, nonblocking suggestion
Co-authored-by: Davida (she/they) <davida.marion@gsa.gov>
🎫 Ticket
Link to the relevant ticket:
LG-11737
🛠 Summary of changes
Was a little too hasty with #10106 and realized the issue stems not from
nilintegration_usageneeding to be an empty array but for service providers which have no integrations at all