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

Don't really want to nullify upon soft deletion #40

Open
joelmichael opened this issue Mar 12, 2018 · 1 comment
Open

Don't really want to nullify upon soft deletion #40

joelmichael opened this issue Mar 12, 2018 · 1 comment

Comments

@joelmichael
Copy link

Recently I've been adding some functionality to our app to hard-delete certain records in order to comply with European regulations. As a result of this, I've been adding dependent: :nullify to a lot of our associations.

The comment I want to make is that I think soft_deletion should basically disregard the "nullify" option. It only really has any relevance in the case of hard deletion, where we nonetheless are willing to keep certain orphaned records around. We do still use soft_deletion in most cases, and I don't want to set these records as :destroy just to avoid soft_delete nullifying them.

I figured this is worth discussing so I decided to make an issue about it. Thanks for the gem.

@grosser
Copy link
Owner

grosser commented Mar 13, 2018

so change would need to go https://github.com/grosser/soft_deletion/blob/master/lib/soft_deletion/dependency.rb#L12-L13

downside would be that using the association triggers a query that then returns nil ... so kinda inefficient

so far the approach here was to delete things that cannot be soft-deleted to avoid weird bugs from nils/unfindables ... so I think nulling them is more consistent ... would be open to a PR to make that optional though since it's not very obvious what the behavior should be

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants