Skip to content

HTTPS clone URL

Subversion checkout URL

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