Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

make deprecation more obvious

  • Loading branch information...
commit 68a50047dfc0a8ac7855e89ca2c3d3f6130e99ad 1 parent 2e5bbd0
Dan Croak croaky authored

Showing 1 changed file with 0 additions and 64 deletions. Show diff stats Hide diff stats

  1. +0 64 README.rdoc
64 README.rdoc
Source Rendered
@@ -5,67 +5,3 @@ friendly-identifier is no longer used or maintained by thoughtbot. Please use
5 5
6 6 Thanks!
7 7
8   -=== Philosophy
9   -
10   -It's nice to have human-readable identifiers in your URLs, but can be a bit of a pain to get just right. Overriding to_param to spit out some string after the id is a great technique in a pinch, but I felt like it was high time to come up with something a bit more comprehensive.
11   -
12   -Friendly Identifier uses a source column (such as a name or title) to generate a more compact "friendly identifier". It overrides to_param to use that identifier, and also overrides ActiveRecord::Base#find to search using that identifier.
13   -
14   -Ultimately, it's designed to boil down to a single line in your model that Just Works(tm).
15   -
16   -=== Usage
17   -
18   - friendly_identifier(source_column, options)
19   -
20   - class Foo < ActiveRecord::Base
21   - friendly_identifier :name
22   - end
23   -
24   - class Bar < ActiveRecord::Base
25   - friendly_identifier :title, :scope => :category_id
26   - end
27   -
28   - class Baz < ActiveRecord::Base
29   - friendly_identifier :title, :identifier_column => :url_slug
30   - end
31   -
32   -
33   -=== Options
34   -
35   -* :keep_updated - Change the identifier whenever the field it is based on is changed. Defaults to true, but set to false if you need your identifiers to be customizable or URLs to remain unchanged after creation.
36   -
37   -* :scope - Passed on to validates_uniqueness_of :friendly_identifier.
38   -
39   -* :identifier_column - Pass in the name of an existing column you're already using and would like to reuse for the same sort functionality.
40   -
41   -* Formatting callback: You can override "self.format(str)" in your class to provide your own identifier-formatting method.
42   -
43   -
44   -=== Requirements
45   -
46   -Your models simply need a string column named "friendly_identifier".
47   -
48   -
49   -==== Caveats
50   -
51   -Beware these possible side effects:
52   -
53   -* In many cases, you don't want your URLs to change if you rename the name or title of your object. Use the :keep_updated => false option to handle this, and let the UI handle changing/updating your
54   -
55   -* Can be a bit unpredictable with really complex associations (let me know if you have any trouble)
56   -
57   -* Does validate presence, which effectively requires that your source column be present, so you might as well add a check for that.
58   -
59   -
60   -==== Coming Soon(ish)
61   -
62   -* Generator to create a migration for your models
63   -
64   -
65   -==== Feedback Welcome!
66   -
67   -Feel free to get in touch via email if you have problems, suggestions for improvement, or even just want to show me a site that you used this plugin on.
68   -
69   -Nick Zadrozny<br/>
70   -nick@zadrozny.com (email/jabber/gtalk)<br/>
71   -http://beyondthepath.com/

1 comment on commit 68a5004

Nick Zadrozny
nz commented on 68a5004

Thanks for that. I had abandoned this Rails 1.x plugin long before you guys forked it ;)

Please sign in to comment.
Something went wrong with that request. Please try again.