@@ -90,22 +90,6 @@ If you really want it gone *gone*, call `really_destroy!`:
# => client
```
If you want a method to be called on destroy, simply provide a `before_destroy` callback:
``` ruby
classClient<ActiveRecord::Base
acts_as_paranoid
before_destroy:some_method
defsome_method
# do stuff
end
# ...
end
```
If you want to use a column other than `deleted_at`, you can pass it as an option:
``` ruby
...
...
@@ -172,12 +156,6 @@ If you want to restore a record and their dependently destroyed associated recor
Client.restore(id,:recursive=>true)
```
If you want callbacks to trigger before a restore:
``` ruby
before_restore:callback_name_goes_here
```
For more information, please look at the tests.
## Acts As Paranoid Migration
...
...
@@ -194,6 +172,24 @@ You can replace the older `acts_as_paranoid` methods as follows:
The `recover` method in `acts_as_paranoid` runs `update` callbacks. Paranoia's
`restore` method does not do this.
## Callbacks
Paranoia provides few callbacks. It triggers `destroy` callback when the record is marked as deleted and `real_destroy` when the record is completely removed from database. It also calls `restore` callback when record is restored via paranoia
For example if you want to index you records in some search engine you can do like this: