Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Identify models that have side effect problems when their records are deleted #250

Closed
armahillo opened this issue Jan 30, 2018 · 4 comments
Labels
Help Wanted Groomed + open to all! Needs Discussion

Comments

@armahillo
Copy link
Collaborator

armahillo commented Jan 30, 2018

Ref #248, #249, #243, #239 (indirectly), #223, #258

Deleting stuff is causing problems. The users are doing stuff they're allowed to, there's just side effects that we didn't anticipate with how deleting individual items might affect the associations with other items.

We should review all the models for:

  • Do users really need to be able to delete records
  • How should deletions be handled
  • What related models need to be checked for integrity if something is deleted
@armahillo armahillo added the Help Wanted Groomed + open to all! label Jan 30, 2018
@armahillo armahillo added this to the National Diaper Bank Demo milestone Jan 30, 2018
@seanmarcia
Copy link
Member

seanmarcia commented Feb 24, 2018

I think if we add in a gem like acts_as_paranoid or archivable we could achieve the same result of "deleting" an item but keeping it in the background of we need it again.

@dacur
Copy link
Collaborator

dacur commented Mar 12, 2018

This is also a feature of RuboCop, which is something I'm working on adding (see #290) and the docs. It will notify you, for instance, if you have a missing dependent: destroy.

@dacur
Copy link
Collaborator

dacur commented Mar 16, 2018

Relationships lacking a dependent: something:

Item: has_many line_items
Item: has_many inventory_items
Item: has_many barcode_items
DonationSite: has_many donations
StorageLocation: has_many inventory_items
StorageLocation: has_many donations
StorageLocation: has_many distributions
DiaperDriveParticipant has_many donations
Organization has_many adjustments
Organization has_many distributions
Organization has_many donations
Organization has_many donation_sites
Organization has_many diaper_drive_participants
Organization has_many storage_locations
Organization has_many items
Organization has_many partners
Organization has_many transfers
Organization has_many users
Partner has_many distributions
Itemizable has_many line_items

May have missed a few or included some by mistake.

@seanmarcia
Copy link
Member

Looks like when Rubocop gets merged in this will be taken care of.

We may want another issue about adding in soft deletes via papertrail or acts_as_paranoid but for now I'm closing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Help Wanted Groomed + open to all! Needs Discussion
Projects
None yet
Development

No branches or pull requests

3 participants