norman / friendly_id

FriendlyId is the “Swiss Army bulldozer” of slugging and permalink plugins for ActiveRecord. It allows you to create pretty URL’s and work with human-friendly strings as if they were numeric ids for ActiveRecord models.
http://norman.github.io/friendly_id/
MIT License
6.13k stars 589 forks source link

Fix collision errors when introducing history plugin after the fact #991

Open tarzan opened 2 years ago

tarzan commented 2 years ago

I've redone the work of #850

The problem that still exists in this current version is:

  1. implement the friendly_id slugs
  2. figuring out somewhere along the line that you want the history plugin as well
  3. create a new sluggable record that would translate to an already existing slug
  4. fails with a database constraint on unique slugs

The method 'scope_for_slug_generator' did a bit too much work with an inner join that made existing records with no entry in the history table being filtered out.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

parndt commented 2 years ago

Thank you for redoing this @tarzan 😄

tarzan commented 1 year ago

Thank you for redoing this @tarzan 😄

Before this becoming stale again: anything keeping you from merging this?

parndt commented 1 year ago

I think it's good @tarzan

@norman can you think of any gotchas here? I've not used the history plugin before.