Best way to generate slugs (human-readable IDs) in Rails

前端 未结 12 825
北荒
北荒 2020-11-30 18:05

You know, like myblog.com/posts/donald-e-knuth.

Should I do this with the built in parameterize method?

What about a plugin? I could imagine a plugin being n

12条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-30 18:52

    Recently I had the same dilemma.

    Since, like you, I don't want to reinvent the wheel, I chose friendly_id following the comparison on The Ruby Toolbox: Rails Permalinks & Slugs.

    I based my decision on:

    • number of github watchers
    • no. of github forks
    • when was the last commit made
    • no. of downloads

    Hope this helps in taking the decision.

提交回复
热议问题