JackDanger / permanent_records

Rails Plugin - soft-delete your ActiveRecord records. It's like an explicit version of ActsAsParanoid
https://jdanger.com
MIT License
272 stars 64 forks source link

Handling :dependent => :nullify #44

Open JohnKacz opened 9 years ago

JohnKacz commented 9 years ago

So looking at how revive_destroyed_dependent_records works it seems there is no way currently to restore the association to nullified dependents. Correct?

Could this be handled by checking for :nullify in get_dependentrecords and then if the dependent class has a column dead[association]id moving the id to to that column and then going ahead and nullifying the records? This would then follow that revive would look for the dead[association]_id column and reverse the operation.

JackDanger commented 9 years ago

@JohnKacz I think that's a good idea. Care to put together a PR?

JohnKacz commented 9 years ago

Ya, as I was typing it out that was exactly my thought - this is more of a feature request which means I should probably fork and implement. sigh I'll see if I can make some time but I'm not the most git-savvy and I'll want to look through the current code base some more.

Thanks.

JackDanger commented 9 years ago

@JohnKacz You don't have to get it perfect. Just hit the 'fork' button and take a whack at it. Then you and I or anybody else who contributes here can help you figure out how to get things in the right shape. Glad to have your help!