goncalossilva/rails3_acts_as_paranoid — pull request #55 by chuckg (2012-03-06 19:31:10+00:00)
Title: Rails 3.2, associations, extra tests

A collection of updates and enhancements. I also did a pretty large reorganization of the code (created a `ActsAsParanoid::Core`).

* Updated to support Rails 3.2 (strictly)
* Added support for multiple default scopes on a model
* Added tests around Klass.paranoid?
* Added tests around deletion through a relation:
* Fake removal:

```
ParanoidObject.scope.destroy(object_id)
paranoid_object.has_many_association.order(:id).destroy_all -> hooks into object.destroy
```

* Real removal:

```
ParanoidObject.scope.destroy!(object_id)
paranoid_object.has_many_association.order(:id).destroy(has_many_association_object_id)
paranoid_object.has_many_association.only_deleted.destroy(has_many_association_object_id)
paranoid_object.has_many_association.order(:id).destroy_all
paranoid_object.has_many_association.only_deleted.destroy_all
paranoid_object.has_many_association.order(:id).delete_all!
```

* `with_deleted` and `only_deleted` are fully chainable with scopes and relations:

Object.some_scope.with_deleted == Object.with_deleted.some_scope
Object.only_deleted.where(..) == Object.where(..).only_deleted

* Added `:with_deleted` option to `belongs_to`
* inspiration from: https://github.com/goncalossilva/rails3_acts_as_paranoid/pull/48