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

Slug separator not working #979

Closed chrism closed 2 years ago

chrism commented 3 years ago

I've added to config/initializers/friendly_id.rb the two lines

config.use :slugged
config.sequence_separator = '_'

And even tried including in my models

  extend FriendlyId
  friendly_id :name, use: :slugged, sequence_separator: "_"

But no matter what, if I create a new model the slug is still parameterized with a hyphen.

Model.create(name:'with separator')
#<Model id: 1, name: "with separator", slug: "with-separator">

I've read similar issues like https://github.com/norman/friendly_id/issues/650 which has now been closed, but still have not been able to get this to work and tried everything suggested.

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.

initseis commented 5 months ago

Check this solution: https://stackoverflow.com/a/30323207/23497576