destroy a record once all of its belongs_to associations are destroyed
===

I want to destroy `Book` once its owners(i.e. the records it belongs to) are destroyed.

If there are only one `belongs_to` relationship, the `dependent` option simple works.

    class Book < ActiveRecord::Base
      belongs_to :shop
    end

    class Book < ActiveRecord::Base
      has_many :books, :dependent => :destroy
    end

But if there are more `belongs_to` relationship? For instance:

    class Book < ActiveRecord::Base
      belongs_to :shop
      belongs_to :cart
    end

I want to destroyed the `Book` once **all** of its owners are destroyed. If a `Cart` and a `Shop` own the same `Book`, and the `Shop` is destroyed but `Cart` isn't, the `Book` wouldn't be destroyed.