Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 111 lines (69 sloc) 3.356 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
004d623 @norman Docs tweaks
authored
25 ## Version 4.x
26
f5f28ca @norman Update docs, bump version
authored
27 FriendlyId 4.x introduces many changes incompatible with 3.x. If you're
28 upgrading, please [read the
29 docs](http://norman.github.com/friendly_id/file.WhatsNew.html) to see what's
30 new.
004d623 @norman Docs tweaks
authored
31
8777f06 @norman Initial commit to 4.0.0
authored
32 ## Rails Quickstart
33
34 gem install friendly_id
35
36 rails new my_app
37
38 cd my_app
39
f5f28ca @norman Update docs, bump version
authored
40 gem "friendly_id", "~> 4.0.0.beta8"
204c477 @norman Bump version, update README
authored
41
8777f06 @norman Initial commit to 4.0.0
authored
42
43 rails generate scaffold user name:string slug:string
44
45 # edit db/migrate/*_create_users.rb
46 add_index :users, :slug, :unique => true
47
48 rake db:migrate
49
50 # edit app/models/user.rb
51 class User < ActiveRecord::Base
70c8884 @norman has_friendly_id => friendly_id, and accept "use" arg to load modules
authored
52 extend FriendlyId
53 friendly_id :name, :use => :slugged
8777f06 @norman Initial commit to 4.0.0
authored
54 end
55
56 User.create! :name => "Joe Schmoe"
57
58 rails server
59
60 GET http://localhost:3000/users/joe-schmoe
61
f68be81 @norman Added link to docs
authored
62 ## Docs
63
64 The current docs can be found
f5f28ca @norman Update docs, bump version
authored
65 [here](http://norman.github.com/friendly_id/)
a4128af @norman Continued work on docs
authored
66
ce7eb3c @norman Worked on documentation.
authored
67 ## Benchmarks
68
69 The latest benchmarks for FriendlyId are maintained
70 [here](https://gist.github.com/1129745).
71
72
8777f06 @norman Initial commit to 4.0.0
authored
73 ## Bugs
74
bda2b36 @norman Doc tweaks
authored
75 Please report them on the [Github issue
76 tracker](http://github.com/norman/friendly_id/issues) for this project.
8777f06 @norman Initial commit to 4.0.0
authored
77
78 If you have a bug to report, please include the following information:
79
80 * **Version information for FriendlyId, Rails and Ruby.**
81 * Stack trace and error message.
bda2b36 @norman Doc tweaks
authored
82 * Any snippets of relevant model, view or controller code that shows how you
8777f06 @norman Initial commit to 4.0.0
authored
83 are using FriendlyId.
84
85 If you are able to, it helps even more if you can fork FriendlyId on Github,
86 and add a test that reproduces the error you are experiencing.
87
88 ## Credits
89
bda2b36 @norman Doc tweaks
authored
90 FriendlyId was originally created by Norman Clarke and Adrian Mugnolo, with
91 significant help early in its life by Emilio Tagua. I'm deeply gratful for the
92 generous contributions over the years from [many
8777f06 @norman Initial commit to 4.0.0
authored
93 volunteers](https://github.com/norman/friendly_id/contributors).
94
d261d19 @norman Added note on Slugged
authored
95 Part of the inspiration to rework FriendlyId came from Darcy Laycock's library
96 [Slugged](https://github.com/Sutto/slugged), which he was inspired to create
97 because of frustrations he experienced while using FriendlyId 3.x. Seeing a
98 smart programmer become frustrated with my code was enough of a kick in the
99 butt to make me want to improve this library significantly.
100
101 Many thanks to him for providing valid, real criticism while still being a cool
102 about it. I definitely recommend you check out his library if for some reason
103 FriendlyId doesn't do it for you.
104
ee73161 @norman Added Travis status image
authored
105 Lastly, FriendlyId uses [Travis](http://travis-ci.org/) for continuous
106 integration. It's an excellent, free service created by a whole bunch of [good
107 people](https://github.com/travis-ci) - if you're not already using it, you
108 should be!
109
8777f06 @norman Initial commit to 4.0.0
authored
110 Copyright (c) 2008-2011 Norman Clarke, released under the MIT license.
Something went wrong with that request. Please try again.