https://github.com/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.
https://github.com/norman/friendly_id
Keywords
friendly-url plugin rails ruby slug
Keywords from Contributors
activerecord activejob mvc rubygems rspec devise rack crash-reporting sinatra sidekiq
Last synced: about 13 hours ago
JSON representation
Repository metadata
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.
- Host: GitHub
- URL: https://github.com/norman/friendly_id
- Owner: norman
- License: mit
- Created: 2008-04-18T13:16:06.000Z (over 17 years ago)
- Default Branch: master
- Last Pushed: 2025-11-25T02:09:44.000Z (15 days ago)
- Last Synced: 2025-12-01T17:42:42.218Z (9 days ago)
- Topics: friendly-url, plugin, rails, ruby, slug
- Language: Ruby
- Homepage: http://norman.github.io/friendly_id/
- Size: 3.69 MB
- Stars: 6,222
- Watchers: 55
- Forks: 593
- Open Issues: 32
- Releases: 0
-
Metadata Files:
- Readme: README.md
- Changelog: Changelog.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: MIT-LICENSE
README.md
FriendlyId
For the most complete, user-friendly documentation, see the FriendlyId Guide.
FriendlyId is the "Swiss Army bulldozer" of slugging and permalink plugins for
Active Record. It lets you create pretty URLs and work with human-friendly
strings as if they were numeric ids.
With FriendlyId, it's easy to make your application use URLs like:
https://example.com/states/washington
instead of:
https://example.com/states/4323454
Getting Help
Ask questions on Stack Overflow
using the "friendly-id" tag, and for bugs have a look at the bug section
FriendlyId Features
FriendlyId offers many advanced features, including:
- slug history and versioning
- i18n
- scoped slugs
- reserved words
- custom slug generators
Usage
Add this line to your application's Gemfile:
gem 'friendly_id', '~> 5.5.0'
Note: You MUST use 5.0.0 or greater for Rails 4.0+.
And then execute:
bundle install
Add a slug column to the desired table (e.g. Users)
rails g migration AddSlugToUsers slug:uniq
Generate the friendly configuration file and a new migration
rails generate friendly_id
Note: You can delete the CreateFriendlyIdSlugs migration if you won't use the slug history feature. (Read more)
Run the migration scripts
rails db:migrate
Edit the app/models/user.rb file as the following:
class User < ApplicationRecord
extend FriendlyId
friendly_id :name, use: :slugged
end
Edit the app/controllers/users_controller.rb file and replace User.find by User.friendly.find
class UserController < ApplicationController
def show
@user = User.friendly.find(params[:id])
end
end
Now when you create a new user like the following:
User.create! name: "Joe Schmoe"
You can then access the user show page using the URL http://localhost:3000/users/joe-schmoe.
If you're adding FriendlyId to an existing app and need to generate slugs for
existing users, do this from the console, runner, or add a Rake task:
User.find_each(&:save)
Options
:allow_nil
You can pass allow_nil: true to the friendly.find() method if you want to
avoid raising ActiveRecord::RecordNotFound and accept nil.
Example
MyModel.friendly.find("bad-slug") # where bad-slug is not a valid slug
MyModel.friendly.find(123) # where 123 is not a valid primary key ID
MyModel.friendly.find(nil) # maybe you have a variable/param that's potentially nil
#=> raise ActiveRecord::RecordNotFound
MyModel.friendly.find("bad-slug", allow_nil: true)
MyModel.friendly.find(123, allow_nil: true)
MyModel.friendly.find(nil, allow_nil: true)
#=> nil
Bugs
Please report them on the Github issue
tracker for this project.
If you have a bug to report, please include the following information:
- Version information for FriendlyId, Rails and Ruby.
- Full stack trace and error message (if you have them).
- Any snippets of relevant model, view or controller code that shows how you
are using FriendlyId.
If you are able to, it helps even more if you can fork FriendlyId on Github,
and add a test that reproduces the error you are experiencing.
For more inspiration on how to report bugs, please see this
article.
Thanks and Credits
FriendlyId was originally created by Norman Clarke and Adrian Mugnolo, with
significant help early in its life by Emilio Tagua. It is now maintained by
Norman Clarke and Philip Arndt.
We're deeply grateful for the generous contributions over the years from many
volunteers.
License
Copyright (c) 2008-2020 Norman Clarke and contributors, released under the MIT
license.
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Owner metadata
- Name: Norman Clarke
- Login: norman
- Email:
- Kind: user
- Description: Upstate New Yorker transplanted to Buenos Aires. Developer and amateur musician.
- Website:
- Location: Buenos Aires, Argentina
- Twitter: compay
- Company: @bentohq
- Icon url: https://avatars.githubusercontent.com/u/5042?u=8dac771545311e86c62eee4ed1319767d8b4a86c&v=4
- Repositories: 71
- Last ynced at: 2023-04-10T08:56:55.634Z
- Profile URL: https://github.com/norman
GitHub Events
Total
- Issues event: 3
- Watch event: 87
- Delete event: 1
- Issue comment event: 19
- Push event: 2
- Pull request review comment event: 4
- Pull request review event: 2
- Pull request event: 10
- Fork event: 11
- Create event: 1
Last Year
- Issues event: 3
- Watch event: 62
- Delete event: 1
- Issue comment event: 18
- Push event: 2
- Pull request review comment event: 4
- Pull request review event: 2
- Pull request event: 8
- Fork event: 6
- Create event: 1
Committers metadata
Last synced: 4 days ago
Total Commits: 1,437
Total Committers: 192
Avg Commits per committer: 7.484
Development Distribution Score (DDS): 0.428
Commits in past year: 4
Committers in past year: 3
Avg Commits per committer in past year: 1.333
Development Distribution Score (DDS) in past year: 0.5
| Name | Commits | |
|---|---|---|
| Norman Clarke | n****n@n****m | 822 |
| Philip Arndt | g****t@p****o | 89 |
| Norman Clarke | n****n@r****g | 82 |
| norman | n****n@e****2 | 22 |
| Adrian Mugnolo | a****n@w****m | 20 |
| Emilio Tagua | m****s@g****m | 19 |
| Norman Clarke | n****n@a****m | 17 |
| Adrian Mugnolo | a****n@m****m | 11 |
| Peter M. Goldstein | p****n@g****m | 11 |
| John Hawthorn | j****n@h****l | 10 |
| Sergey Tsvetkov | s****v@g****m | 10 |
| Bruno Michel | b****l@m****o | 10 |
| Andrew White | a****w@p****k | 8 |
| Alex Coles | a****x@a****m | 8 |
| Ben Woosley | b****y@g****m | 6 |
| Niall Burkley | n****y@g****m | 6 |
| Erik Ogan and Thomas Shafer | t****s@c****g | 5 |
| Jamie Davidson | j****8@g****m | 5 |
| Gagan Awhad | g****d@g****m | 4 |
| Kirill Shnurov | k@z****u | 4 |
| Norman Clarke | n****n@e****n | 4 |
| Tomás Arribas | t****s@b****m | 4 |
| Florian Aßmann | f****y@f****e | 4 |
| Enrico Pilotto | e****o@m****t | 4 |
| Chris Salzberg | c****g@g****m | 4 |
| Dave Gynn | d****n@g****m | 4 |
| Marc Rendl Ignacio | m****o@g****m | 4 |
| Oleksandr Petrov | o****v@g****m | 4 |
| Olivier Lacan | hi@o****m | 4 |
| PikachuEXE | p****e@g****m | 4 |
| and 162 more... | ||
Committer domains:
- me.com: 5
- lazyatom.com: 1
- jjb.cc: 1
- technicalpickles.com: 1
- eee.(none): 1
- cllns.com: 1
- altovista.nl: 1
- tekin.co.uk: 1
- saizai.com: 1
- yurkowski.net: 1
- scilipoti.name: 1
- joesak.com: 1
- hashrocket.com: 1
- bonamin.org: 1
- fea.st: 1
- godaddy.com: 1
- sphereconsultinginc.com: 1
- tribesports.com: 1
- stevenluscherdesign.com: 1
- applauze.com: 1
- g-majeur.nl: 1
- njclarke.com: 1
- p.arndt.io: 1
- randomba.org: 1
- wyeworks.com: 1
- addthree.com: 1
- mugnolo.com: 1
- hawthorn.email: 1
- menfin.info: 1
- pixeltrix.co.uk: 1
- alexcolesportfolio.com: 1
- change.org: 1
- zx0.ru: 1
- eee.localdomain: 1
- buenostalleres.com: 1
- fork.de: 1
- megiston.it: 1
- olivierlacan.com: 1
- suse.de: 1
- tipogral.hu: 1
- 5stops.com: 1
- williammelody.com: 1
- yandex.ru: 1
- teamon.eu: 1
- tonycode.com: 1
- rougecardinal.fr: 1
- recurser.com: 1
- fone.net.nz: 1
- room118solutions.com: 1
- kulyk.ca: 1
- andywaite.com: 1
- austinpray.com: 1
- riotinto.com: 1
- einti.com: 1
- sporkmonger.com: 1
- johankok.nl: 1
- aput.net: 1
- shedcode.co.uk: 1
- verschooten.net: 1
- zedroot.org: 1
- ogan.net: 1
- schito.me: 1
- websaviour.com: 1
- pivotallabs.com: 1
- publicearth.com: 1
- magmalabs.io: 1
- pivotal.io: 1
- nasa.gov: 1
- 42network.org: 1
- vaio.(none): 1
- infotech.com: 1
- infochimps.org: 1
- brigade.com: 1
- artsicle.com: 1
- ryanschlesinger.com: 1
- ramonsoares.com: 1
- mac.com: 1
- amerine.net: 1
- studiomelipone.eu: 1
- kenrose.org: 1
- gmx.de: 1
- linuxonrails.com: 1
- yahoo.com.br: 1
Issue and Pull Request metadata
Last synced: about 13 hours ago
Total issues: 74
Total pull requests: 69
Average time to close issues: 6 months
Average time to close pull requests: 4 months
Total issue authors: 72
Total pull request authors: 35
Average comments per issue: 4.01
Average comments per pull request: 2.07
Merged pull request: 45
Bot issues: 0
Bot pull requests: 4
Past year issues: 3
Past year pull requests: 15
Past year average time to close issues: 7 months
Past year average time to close pull requests: 11 days
Past year issue authors: 3
Past year pull request authors: 7
Past year average comments per issue: 3.33
Past year average comments per pull request: 0.67
Past year merged pull request: 6
Past year bot issues: 0
Past year bot pull requests: 2
Top Issue Authors
- vfonic (2)
- ConfusedVorlon (2)
- 9mm (1)
- wakilo (1)
- ronald2wing (1)
- fcandi (1)
- joeradtke (1)
- shir (1)
- mockdeep (1)
- freibuis (1)
- maxime-carbonneau (1)
- joker-777 (1)
- plewasebastian (1)
- fidalgo (1)
- iwdt (1)
Top Pull Request Authors
- parndt (15)
- dependabot[bot] (4)
- alejandroperea (3)
- petergoldstein (3)
- dchacke (2)
- maxcal (2)
- ghbooth12 (2)
- return-nil (2)
- joemsak (2)
- sbeckeriv (2)
- mattbrictson (2)
- oehlschl (2)
- willnet (2)
- maxime-carbonneau (2)
- xymbol (2)
Top Issue Labels
- stale (17)
- pinned (12)
- Bug (1)
- Looking for help (1)
Top Pull Request Labels
- stale (5)
- dependencies (4)
- pinned (2)
- Looking for help (2)
- github_actions (2)
- Bug (1)
Package metadata
- Total packages: 11
-
Total downloads:
- rubygems: 104,352,154 total
- Total docker downloads: 54,795,332
- Total dependent packages: 223 (may contain duplicates)
- Total dependent repositories: 18,405 (may contain duplicates)
- Total versions: 263
- Total maintainers: 6
gem.coop: friendly_id
FriendlyId is the "Swiss Army bulldozer" of slugging and permalink plugins for Active Record. It lets you create pretty URLs and work with human-friendly strings as if they were numeric ids.
- Homepage: https://github.com/norman/friendly_id
- Documentation: http://www.rubydoc.info/gems/friendly_id/
- Licenses: MIT
- Latest release: 5.6.0 (published 4 days ago)
- Last Synced: 2025-12-09T13:31:17.703Z (about 22 hours ago)
- Versions: 112
- Dependent Packages: 0
- Dependent Repositories: 0
- Downloads: 52,013,541 Total
- Docker Downloads: 27,397,666
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 0.31%
- Downloads: 0.49%
- Docker downloads count: 0.75%
- Maintainers (3)
rubygems.org: friendly_id
FriendlyId is the "Swiss Army bulldozer" of slugging and permalink plugins for Active Record. It lets you create pretty URLs and work with human-friendly strings as if they were numeric ids.
- Homepage: https://github.com/norman/friendly_id
- Documentation: http://www.rubydoc.info/gems/friendly_id/
- Licenses: MIT
- Latest release: 5.6.0 (published 4 days ago)
- Last Synced: 2025-12-08T15:30:20.663Z (2 days ago)
- Versions: 112
- Dependent Packages: 219
- Dependent Repositories: 18,247
- Downloads: 51,986,095 Total
- Docker Downloads: 27,397,666
-
Rankings:
- Dependent packages count: 0.178%
- Stargazers count: 0.194%
- Dependent repos count: 0.264%
- Downloads: 0.475%
- Average: 0.512%
- Docker downloads count: 0.84%
- Forks count: 1.118%
- Maintainers (3)
gem.coop: friendly_id_globalize3
FriendlyId is the "Swiss Army bulldozer" of slugging and permalink plugins for Ruby on Rails. It allows you to create pretty URL's and work with human-friendly strings as if they were numeric ids for ActiveRecord models.
- Homepage: http://norman.github.com/friendly_id
- Documentation: http://www.rubydoc.info/gems/friendly_id_globalize3/
- Licenses: mit
- Latest release: 3.2.1 (published almost 15 years ago)
- Last Synced: 2025-12-07T21:03:02.521Z (3 days ago)
- Versions: 8
- Dependent Packages: 0
- Dependent Repositories: 0
- Downloads: 135,701 Total
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 2.62%
- Downloads: 7.859%
- Maintainers (1)
rubygems.org: friendly_id_globalize3
FriendlyId is the "Swiss Army bulldozer" of slugging and permalink plugins for Ruby on Rails. It allows you to create pretty URL's and work with human-friendly strings as if they were numeric ids for ActiveRecord models.
- Homepage: http://norman.github.com/friendly_id
- Documentation: http://www.rubydoc.info/gems/friendly_id_globalize3/
- Licenses: mit
- Latest release: 3.2.1 (published almost 15 years ago)
- Last Synced: 2025-12-07T21:03:02.185Z (3 days ago)
- Versions: 8
- Dependent Packages: 4
- Dependent Repositories: 157
- Downloads: 135,701 Total
-
Rankings:
- Stargazers count: 0.192%
- Forks count: 0.898%
- Dependent repos count: 2.337%
- Average: 2.75%
- Dependent packages count: 3.253%
- Downloads: 7.071%
- Maintainers (1)
proxy.golang.org: github.com/norman/friendly_id
- Homepage:
- Documentation: https://pkg.go.dev/github.com/norman/friendly_id#section-documentation
- Licenses:
- Latest release: v5.6.0+incompatible (published 4 days ago)
- Last Synced: 2025-12-07T07:13:21.699Z (3 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent packages count: 5.059%
- Average: 5.228%
- Dependent repos count: 5.398%
gem.coop: geothird_friendly_id
FriendlyId is the "Swiss Army bulldozer" of slugging and permalink plugins for Ruby on Rails. It allows you to create pretty URLs and work with human-friendly strings as if they were numeric ids for Active Record models.
- Homepage: http://github.com/norman/friendly_id
- Documentation: http://www.rubydoc.info/gems/geothird_friendly_id/
- Licenses: mit
- Latest release: 4.0.9.8 (published over 12 years ago)
- Last Synced: 2025-12-07T21:03:01.385Z (3 days ago)
- Versions: 8
- Dependent Packages: 0
- Dependent Repositories: 0
- Downloads: 26,868 Total
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 7.811%
- Downloads: 23.433%
- Maintainers (1)
rubygems.org: geothird_friendly_id
FriendlyId is the "Swiss Army bulldozer" of slugging and permalink plugins for Ruby on Rails. It allows you to create pretty URLs and work with human-friendly strings as if they were numeric ids for Active Record models.
- Homepage: http://github.com/norman/friendly_id
- Documentation: http://www.rubydoc.info/gems/geothird_friendly_id/
- Licenses: mit
- Latest release: 4.0.9.8 (published over 12 years ago)
- Last Synced: 2025-12-07T21:03:00.740Z (3 days ago)
- Versions: 8
- Dependent Packages: 0
- Dependent Repositories: 0
- Downloads: 26,868 Total
-
Rankings:
- Stargazers count: 0.156%
- Forks count: 0.834%
- Dependent packages count: 15.706%
- Average: 17.29%
- Downloads: 22.969%
- Dependent repos count: 46.782%
- Maintainers (1)
gem.coop: mil_friendly_id
FriendlyId is the "Swiss Army bulldozer" of slugging and permalink plugins for Ruby on Rails. It allows you to create pretty URLs and work with human-friendly strings as if they were numeric ids for Active Record models.
- Homepage: http://github.com/norman/friendly_id
- Documentation: http://www.rubydoc.info/gems/mil_friendly_id/
- Licenses: mit
- Latest release: 4.0.9.9 (published over 12 years ago)
- Last Synced: 2025-12-07T21:03:03.249Z (3 days ago)
- Versions: 2
- Dependent Packages: 0
- Dependent Repositories: 0
- Downloads: 8,104 Total
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 17.85%
- Downloads: 53.55%
- Maintainers (2)
rubygems.org: cmassimo-friendly_id
FriendlyId is the "Swiss Army bulldozer" of slugging and permalink plugins for Ruby on Rails. It allows you to create pretty URL’s and work with human-friendly strings as if they were numeric ids for ActiveRecord models. -- Forked by cmassimo see http://github.com/cmassimo/friendly_id for further details
- Homepage: http://norman.github.com/friendly_id
- Documentation: http://www.rubydoc.info/gems/cmassimo-friendly_id/
- Licenses: mit
- Latest release: 3.0.4.2 (published over 15 years ago)
- Last Synced: 2025-12-07T21:03:01.972Z (3 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 1
- Downloads: 5,586 Total
-
Rankings:
- Stargazers count: 0.192%
- Forks count: 0.898%
- Dependent packages count: 15.575%
- Average: 20.428%
- Dependent repos count: 21.793%
- Downloads: 63.684%
- Maintainers (1)
gem.coop: cmassimo-friendly_id
FriendlyId is the "Swiss Army bulldozer" of slugging and permalink plugins for Ruby on Rails. It allows you to create pretty URL’s and work with human-friendly strings as if they were numeric ids for ActiveRecord models. -- Forked by cmassimo see http://github.com/cmassimo/friendly_id for further details
- Homepage: http://norman.github.com/friendly_id
- Documentation: http://www.rubydoc.info/gems/cmassimo-friendly_id/
- Licenses: mit
- Latest release: 3.0.4.2 (published over 15 years ago)
- Last Synced: 2025-12-07T21:03:01.621Z (3 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
- Downloads: 5,586 Total
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 21.442%
- Downloads: 64.325%
- Maintainers (1)
rubygems.org: mil_friendly_id
FriendlyId is the "Swiss Army bulldozer" of slugging and permalink plugins for Ruby on Rails. It allows you to create pretty URLs and work with human-friendly strings as if they were numeric ids for Active Record models.
- Homepage: http://github.com/norman/friendly_id
- Documentation: http://www.rubydoc.info/gems/mil_friendly_id/
- Licenses: mit
- Latest release: 4.0.9.9 (published over 12 years ago)
- Last Synced: 2025-12-07T21:03:01.614Z (3 days ago)
- Versions: 2
- Dependent Packages: 0
- Dependent Repositories: 0
- Downloads: 8,104 Total
-
Rankings:
- Stargazers count: 0.156%
- Forks count: 0.834%
- Dependent packages count: 15.706%
- Average: 23.507%
- Dependent repos count: 46.782%
- Downloads: 54.055%
- Maintainers (2)
Dependencies
- activerecord-jdbcsqlite3-adapter >= 1.3.0.beta2 development
- byebug >= 0 development
- kramdown >= 0 development
- pry >= 0 development
- redcarpet >= 0 development
- sqlite3 >= 0 development
- rake >= 0
- standard >= 0
- coveralls >= 0 development
- ffaker >= 0 development
- i18n >= 0 development
- minitest ~> 5.3 development
- mocha ~> 1.1 development
- railties >= 4.0 development
- simplecov >= 0 development
- yard >= 0 development
- activerecord >= 4.0.0
- actions/checkout v3 composite
- ruby/setup-ruby v1 composite
Score: 32.883931608368734