Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
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.
Ruby

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
test
.gitignore
ABOUT.md
Guide.md
README.md
Rakefile
bench.rb
friendly_id.gemspec

README.md


NOTE This is FriendlyId4 - a rewrite of FriendlyId. For more info about this rewrite, and the changes it brings, read this document.

For the current stable FriendlyId, please see:

https://github.com/norman/friendly_id


FriendlyId

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 Active Record models.

Using FriendlyId, it's easy to make your application use URL's like:

http://example.com/states/washington

instead of:

http://example.com/states/4323454

FriendlyId Features

FriendlyId offers many advanced features, including: slug history and versioning, scoped slugs, reserved words, custom slug generators, and excellent Unicode support. For complete information on using FriendlyId, please see the FriendlyId Guide.

FriendlyId is compatible with Active Record 3.0 and 3.1.

Docs, Info and Support

Rails Quickstart

gem install friendly_id

rails new my_app

cd my_app

# add to Gemfile
gem "friendly_id", "~> 4.0.0"

rails generate scaffold user name:string slug:string

# edit db/migrate/*_create_users.rb
add_index :users, :slug, :unique => true

rake db:migrate

# edit app/models/user.rb
class User < ActiveRecord::Base
  include FriendlyId::Slugged
  has_friendly_id :name
end

User.create! :name => "Joe Schmoe"

rails server

GET http://localhost:3000/users/joe-schmoe

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.
  • Stack trace and error message.
  • Any snippets of relevant model, view or controller code that shows how your 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.

Credits

FriendlyId was created by Norman Clarke, Adrian Mugnolo, and Emilio Tagua, and has had significant contributions over the years from many volunteers.

Copyright (c) 2008-2011 Norman Clarke, released under the MIT license.

Something went wrong with that request. Please try again.