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.15k stars 591 forks source link

V 5.4.0 breaking change to Object.friendly.find method #950

Closed ccasabona closed 3 years ago

ccasabona commented 4 years ago

Before merge of 787, one could pass a mixed-case slug to friendly.find as such:

Customer.friendly.find(params[:id])

We don't use the customer name for the slug; rather we used SecureRandom.urlsafe_base64 to generate a random string. Thus the slugs for our customers contain a mix of upper and lowercase characters. At this point we have thousands of customers with mixed-case slugs in our databases.

Because this is breaking (for us) some kind of opt-in to the new behavior would seem to make the most sense.

parndt commented 4 years ago

I'm pretty keen to revert this change and make it opt-in by default. I'll open a PR with the revert to start things off.

ansonhoyt commented 4 years ago

Since this is a breaking change, and defaulting to opt-in, should this new default behavior go in a 6.0.0 release (semver)?

Edit Woops, after re-reading https://github.com/norman/friendly_id/pull/951, I see I'm mistaken. Looks like the breaking id.downcase change in 5.4.0 will be reverted. This new ability will be available for those who need it by overriding the new parse_friendly_id method.

My bad! This will really be "opt-in", and wouldn't be a breaking change.

ethicalhack3r commented 4 years ago

This also broke our slugs on wpvulndb.com, reverting back to version 5.3.0 fixed the issue.

gem 'friendly_id', '5.3.0' in Gemfile

coopeu commented 4 years ago

Me too! updating to 5.4.0 on MilRevolts.life Thanks ethicalhack3r