Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 96 lines (58 sloc) 2.758 kB
8777f06 @norman Initial commit to 4.0.0
authored
1 # FriendlyId
2
ee73161 @norman Added Travis status image
authored
3 [![Build Status](http://travis-ci.org/norman/friendly_id.png)](http://travis-ci.org/norman/friendly_id)
4
8777f06 @norman Initial commit to 4.0.0
authored
5 FriendlyId is the "Swiss Army bulldozer" of slugging and permalink plugins for
a4128af @norman Continued work on docs
authored
6 Ruby on Rails. It allows you to create pretty URL's and work with human-friendly
7 strings as if they were numeric ids for Active Record models.
8777f06 @norman Initial commit to 4.0.0
authored
8
9 Using FriendlyId, it's easy to make your application use URL's like:
10
11 http://example.com/states/washington
12
13 instead of:
14
15 http://example.com/states/4323454
16
f68be81 @norman Added link to docs
authored
17
8777f06 @norman Initial commit to 4.0.0
authored
18 ## FriendlyId Features
19
20 FriendlyId offers many advanced features, including: slug history and
a4128af @norman Continued work on docs
authored
21 versioning, scoped slugs, reserved words, and custom slug generators.
8777f06 @norman Initial commit to 4.0.0
authored
22
23 FriendlyId is compatible with Active Record **3.0** and **3.1**.
24
25 ## Rails Quickstart
26
27 gem install friendly_id
28
29 rails new my_app
30
31 cd my_app
32
204c477 @norman Bump version, update README
authored
33 # Add to Gemfile - this will change once version 4 is no longer
34 # in beta, but for now do this:
35 gem "friendly_id4", "4.0.0.beta4", :require => "friendly_id"
36
8777f06 @norman Initial commit to 4.0.0
authored
37
38 rails generate scaffold user name:string slug:string
39
40 # edit db/migrate/*_create_users.rb
41 add_index :users, :slug, :unique => true
42
43 rake db:migrate
44
45 # edit app/models/user.rb
46 class User < ActiveRecord::Base
70c8884 @norman has_friendly_id => friendly_id, and accept "use" arg to load modules
authored
47 extend FriendlyId
48 friendly_id :name, :use => :slugged
8777f06 @norman Initial commit to 4.0.0
authored
49 end
50
51 User.create! :name => "Joe Schmoe"
52
53 rails server
54
55 GET http://localhost:3000/users/joe-schmoe
56
f68be81 @norman Added link to docs
authored
57 ## Docs
58
59 The current docs can be found
60 [here](http://rdoc.info/github/norman/friendly_id/a4128af31d85ee29ad8f/frames).
a4128af @norman Continued work on docs
authored
61
ce7eb3c @norman Worked on documentation.
authored
62 ## Benchmarks
63
64 The latest benchmarks for FriendlyId are maintained
65 [here](https://gist.github.com/1129745).
66
67
8777f06 @norman Initial commit to 4.0.0
authored
68 ## Bugs
69
bda2b36 @norman Doc tweaks
authored
70 Please report them on the [Github issue
71 tracker](http://github.com/norman/friendly_id/issues) for this project.
8777f06 @norman Initial commit to 4.0.0
authored
72
73 If you have a bug to report, please include the following information:
74
75 * **Version information for FriendlyId, Rails and Ruby.**
76 * Stack trace and error message.
bda2b36 @norman Doc tweaks
authored
77 * Any snippets of relevant model, view or controller code that shows how you
8777f06 @norman Initial commit to 4.0.0
authored
78 are using FriendlyId.
79
80 If you are able to, it helps even more if you can fork FriendlyId on Github,
81 and add a test that reproduces the error you are experiencing.
82
83 ## Credits
84
bda2b36 @norman Doc tweaks
authored
85 FriendlyId was originally created by Norman Clarke and Adrian Mugnolo, with
86 significant help early in its life by Emilio Tagua. I'm deeply gratful for the
87 generous contributions over the years from [many
8777f06 @norman Initial commit to 4.0.0
authored
88 volunteers](https://github.com/norman/friendly_id/contributors).
89
ee73161 @norman Added Travis status image
authored
90 Lastly, FriendlyId uses [Travis](http://travis-ci.org/) for continuous
91 integration. It's an excellent, free service created by a whole bunch of [good
92 people](https://github.com/travis-ci) - if you're not already using it, you
93 should be!
94
8777f06 @norman Initial commit to 4.0.0
authored
95 Copyright (c) 2008-2011 Norman Clarke, released under the MIT license.
Something went wrong with that request. Please try again.