public
Rubygem
Description: 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.
Homepage: http://friendly-id.rubyforge.org
Clone URL: git://github.com/norman/friendly_id.git
Improved README.
norman (author)
Fri Oct 31 13:07:47 -0700 2008
commit  4a97d9a31b5fc4ef3dacf3a194fd6592423c2a5e
tree    9f770d3c49d7325c79c9d346506d52759e815caa
parent  4f42375b7652a5a5e6b89ec61557118483b16114
...
49
50
51
52
53
54
55
56
57
 
 
 
 
58
59
60
...
119
120
121
122
 
 
123
124
 
125
126
127
...
150
151
152
153
154
155
156
157
158
159
 
 
 
 
160
161
162
163
164
 
 
 
 
 
165
166
167
...
49
50
51
 
 
 
 
 
 
52
53
54
55
56
57
58
...
117
118
119
 
120
121
122
 
123
124
125
126
...
149
150
151
 
 
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
0
@@ -49,12 +49,10 @@ and you can then write code like this:
0
 
0
 h3. Blog posts ("slugged" models)
0
 
0
-Blog posts generally have title which are *usually* unique, but don't
0
-necessarily have to be.
0
-
0
-In this and similar cases, FriendlyId provides a Slug model separate from your
0
-Post model. The Slug model handles duplicate friendly_ids, as well as
0
-versioning.
0
+Blog posts generally have titles which are distinctive but not necessarily
0
+unique. In this and similar cases, FriendlyId provides a Slug model separate
0
+from your Post model. The Slug model handles duplicate friendly_ids, as well
0
+as versioning.
0
 
0
 Your model code would look something like this:
0
 
0
@@ -119,9 +117,10 @@ you're using as the friendly_id.
0
 
0
 Note that this ovbiously won't work for Chinese, Arabic, Russian, Hebrew,
0
 Thai, etc. because it will pretty much blow away all the chracters... it's
0
-only for languages that use some variant of the Roman alphabet.
0
+only for languages that use some variant of the Roman alphabet, like English
0
+or Polish.
0
 
0
-You must install the "unicode" and "iconv" to use this feature.
0
+You must install the "unicode" and "iconv" gems to use this feature.
0
 
0
 h3. This is all too complicated. Why not just override to_param to return the
0
 id followed by a dasherized string?
0
@@ -150,18 +149,25 @@ that does something like this:
0
     end  
0
   end
0
 
0
-
0
-
0
 h2. Getting it
0
 
0
 Git repository: git://github.com/norman/friendly_id.git
0
 
0
 h2. Setting it up
0
+
0
+FriendlyId is supported with Rails 2.0.0 and higher.
0
+
0
+If you're using Rails 2.1 or higher, you can do the following:
0
   
0
   cd my_app
0
   script/plugin install git://github.com/norman/friendly_id.git
0
   script/generate friendly_id_migration
0
   rake db:migrate
0
+
0
+If you're using Rails 2.0.x, you should either download the tarball from
0
+Github, or use <code>git clone</code> to check out the repo in your
0
+vendor/plugins directory, because Rails 2.0 does not support installing
0
+plugins with git.
0
   
0
 Now add some code to your models:
0
 

Comments