Commit b904d729 by Dario Hamidi Committed by Ryan Bigg

Add note about different behaviors of `recover` vs `restore`.

The `acts_as_paranoid` gem (v0.4.1) uses assignment followed by a call
to `#save` for restoring a record:

    # in #recover
    run_callbacks :recover do
      recover_dependent_associations(options[:recovery_window], options) if options[:recursive]

      self.paranoid_value = nil
      self.save
    end

This runs any `update` callbacks as well as `recover` callbacks.

Paranoia uses `#update_column` instead of `#save`, so no `update`
callbacks are run when restoring a record.

With this commit the difference in behavior is described in the section
"Acts As Paranoid Migration" of the README.

Fixes #134
parent 563c6cbb
......@@ -178,6 +178,10 @@ You can replace the older `acts_as_paranoid` methods as follows:
|`find_with_deleted(:first)` | `Client.with_deleted.first` |
|`find_with_deleted(id)` | `Client.with_deleted.find(id)` |
The `recover` method in `acts_as_paranoid` runs `update` callbacks. Paranoia's
`restore` method does not do this.
## Support for Unique Keys with Null Values
With most databases, a unique key containing a null value will not be enforced because the null value is unique per row.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment