winton/acts_as_archive — Issue #42: Referential integrity after primary key collisions
Author: johncant
Created: 2012-01-02 15:52:23+00:00
State: open

Hi all, I've got a question about this gem:

Supposing I have these models in Rails:

```ruby
class Foo < ActiveRecord::Base
acts_as_archive ....
has_one :bar, :dependent => :destroy
end

class Bar < ActiveRecord::Base
acts_as_archive ...
belongs_to :foo
end
```

Then I do:
```ruby
Foo.find(6).destroy # It ends up in Foo::Archive with id 6 and Foo.find(6).bar ends up in Bar::Archive
```

Then, much later, someone creates another Foo and unluckily it has id 6 and deletes it:
```ruby
Foo.find(6).destroy # Primary key collision
```

What happens to the referential integrity of the archive tables?