norman/friendly_id — Issue #203: Duplicate Entry Error with History
Author: rubyku
Created: 2011-12-29 23:14:59+00:00
State: open

Hey @norman, I've seen the other issues related to duplication errors and upgraded my app from from beta14 to 4.0.0. I uninstalled previous versions of the gem, bundle installed, and restarted everything. I still continued to get the error doing a simple single model save.

```
ActiveRecord::RecordNotUnique: PGError: ERROR: duplicate key value violates unique constraint "index_friendly_id_slugs_on_slug_and_sluggable_type"
: INSERT INTO "friendly_id_slugs" ("slug", "sluggable_id", "sluggable_type", "created_at") VALUES ('intro-to-cnc-basics--9', 207, 'Course', '2011-12-29 23:01:01.001059') RETURNING "id"
```

I tried dropping my friendly ID table and re-creating it with the exact same schema, and the problem went away.

Not exactly sure if that actually fixed the issue or just covered up the problem. Should I just try dropping that table on production or is the culprit more likely to be in the ruby code?