# Soft deletion

**URL:** <https://www.ruby-forum.com/t/soft-deletion/146232>\
**Category:** Rails\
**Created:** [August 19, 2008, 10:04am UTC](https://www.ruby-forum.com/t/soft-deletion/146232 "2008-08-19T10:04:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![deadinplastic](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/d2c977/32.png) [@deadinplastic](https://www.ruby-forum.com/u/deadinplastic)\
**Post date:** [August 19, 2008, 10:04am UTC](https://www.ruby-forum.com/t/soft-deletion/146232/1 "2008-08-19T10:04:08Z")

</div>

So i was wondering about the best way to approach building an  
application with in-place soft deletion.

The requirements so far are:

- rows are never deleted just a flag set as deleted = true
- unique validation does not include deleted rows
- find methods should not return deleted rows
- find\_deleted methods should return deleted rows (so pretty much the  
same as an unmodified find)
- when using find(:include =\> :children), deleted children should not be  
included in the eager fetch, unless :include\_deleted is used

The goal is to have the soft deletion feature behave transparently to  
rails.

What is the best way to go about this? I’m fairly new to ruby and rails  
(I’ve read the Pragmatic Rails book, the pickaxe book and skimmed the  
two recipe books), and I have a vague idea that we should modify the  
find method, but we would also need to change the :include behaviour,  
but I dont really know where to start.

Is this going to become a giant ugly mega hack?☹

---

<div class="post-metadata">

**Author:** ![deadinplastic](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/d2c977/32.png) [@deadinplastic](https://www.ruby-forum.com/u/deadinplastic)\
**Post date:** [August 19, 2008, 10:06am UTC](https://www.ruby-forum.com/t/soft-deletion/146232/2 "2008-08-19T10:06:21Z")

</div>

Isn’t there acts\_as\_paranoid that does this?
