| CARVIEW |
Select Language
HTTP/2 302
server: nginx
date: Tue, 23 Dec 2025 15:18:13 GMT
content-type: text/plain; charset=utf-8
content-length: 0
x-archive-redirect-reason: found capture at 20100215095029
location: https://web.archive.org/web/20100215095029/https://github.com/thoughtbot/friendly-identifier
server-timing: captures_list;dur=1.083460, exclusion.robots;dur=0.113958, exclusion.robots.policy;dur=0.097771, esindex;dur=0.015451, cdx.remote;dur=10.362485, LoadShardBlock;dur=310.107497, PetaboxLoader3.datanode;dur=127.341022, PetaboxLoader3.resolve;dur=86.018894
x-app-server: wwwb-app54-dc6
x-ts: 302
x-tr: 396
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=0
set-cookie: wb-p-SERVER=wwwb-app54; path=/
x-location: All
x-as: 14061
x-rl: 0
x-na: 0
x-page-cache: MISS
server-timing: MISS
x-nid: DigitalOcean
referrer-policy: no-referrer-when-downgrade
permissions-policy: interest-cohort=()
HTTP/2 200
server: nginx
date: Tue, 23 Dec 2025 15:18:14 GMT
content-type: text/html; charset=utf-8
x-archive-orig-server: nginx/0.7.61
x-archive-orig-date: Mon, 15 Feb 2010 09:50:29 GMT
x-archive-orig-connection: close
x-archive-orig-status: 200 OK
x-archive-orig-etag: "4e7926c76a5cf55af5765917fc9c8f93"
x-archive-orig-x-runtime: 115ms
x-archive-orig-content-length: 25956
x-archive-orig-set-cookie: _github_ses=BAh7BiIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNoSGFzaHsGOgpmaXJzdFQGOgpAdXNlZHsGOwZU--99f7c9f1924d21983eb6afcb0587125060b80c14; path=/; expires=Wed, 01 Jan 2020 08:00:00 GMT; HttpOnly
x-archive-orig-cache-control: private, max-age=0, must-revalidate
x-archive-guessed-content-type: text/html
x-archive-guessed-charset: utf-8
memento-datetime: Mon, 15 Feb 2010 09:50:29 GMT
link: ; rel="original", ; rel="timemap"; type="application/link-format", ; rel="timegate"
content-security-policy: default-src 'self' 'unsafe-eval' 'unsafe-inline' data: blob: archive.org web.archive.org web-static.archive.org wayback-api.archive.org athena.archive.org analytics.archive.org pragma.archivelab.org wwwb-events.archive.org
x-archive-src: TLA-20100215075433-00818-00827-ia360904-20100215221925-00000-c/TLA-20100215085230-00829-ia360906.us.archive.org.warc.gz
server-timing: captures_list;dur=0.589943, exclusion.robots;dur=0.020745, exclusion.robots.policy;dur=0.009748, esindex;dur=0.010971, cdx.remote;dur=10.964805, LoadShardBlock;dur=255.926721, PetaboxLoader3.datanode;dur=232.812496, PetaboxLoader3.resolve;dur=118.384077, load_resource;dur=183.778701
x-app-server: wwwb-app54-dc6
x-ts: 200
x-tr: 519
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=1
x-location: All
x-as: 14061
x-rl: 0
x-na: 0
x-page-cache: MISS
server-timing: MISS
x-nid: DigitalOcean
referrer-policy: no-referrer-when-downgrade
permissions-policy: interest-cohort=()
content-encoding: gzip
thoughtbot's friendly-identifier at master - GitHub
This service is courtesy of Pledgie.
thoughtbot / friendly-identifier
- Source
- Commits
- Network (2)
- Issues (0)
- Downloads (0)
- Wiki (1)
- Graphs
-
Branch:
master
click here to add a description
click here to add a homepage
-
Branches (1)
- master ✓
- Tags (0)
Sending Request…
Enable Donations
Pledgie Donations
Once activated, we'll place the following badge in your repository's detail box:
A fork of https://code.google.com/p/friendly-identifier/ — Read more
| name | age | message | |
|---|---|---|---|
| |
README | Mon Apr 13 06:08:21 -0700 2009 | initial commit [cpytel] |
| |
Rakefile | Mon Apr 13 06:08:21 -0700 2009 | initial commit [cpytel] |
| |
init.rb | Mon Apr 13 06:08:21 -0700 2009 | initial commit [cpytel] |
| |
install.rb | Mon Apr 13 06:08:21 -0700 2009 | initial commit [cpytel] |
| |
lib/ | Mon Apr 13 08:12:43 -0700 2009 | allow records to be found with a string id [cpytel] |
| |
tasks/ | Mon Apr 13 06:08:21 -0700 2009 | initial commit [cpytel] |
| |
test/ | Mon Apr 13 08:12:43 -0700 2009 | allow records to be found with a string id [cpytel] |
| |
uninstall.rb | Mon Apr 13 06:08:21 -0700 2009 | initial commit [cpytel] |
README
=== Philosophy
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.
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.
Ultimately, it's designed to boil down to a single line in your model that Just Works(tm).
=== Usage
friendly_identifier(source_column, options)
class Foo < ActiveRecord::Base
friendly_identifier :name
end
class Bar < ActiveRecord::Base
friendly_identifier :title, :scope => :category_id
end
class Baz < ActiveRecord::Base
friendly_identifier :title, :identifier_column => :url_slug
end
=== Options
* :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.
* :scope - Passed on to validates_uniqueness_of :friendly_identifier.
* :identifier_column - Pass in the name of an existing column you're already using and would like to reuse for the same
sort functionality.
* Formatting callback: You can override "self.format(str)" in your class to provide your own identifier-formatting
method.
=== Requirements
Your models simply need a string column named "friendly_identifier".
==== Caveats
Beware these possible side effects:
* 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
* Can be a bit unpredictable with really complex associations (let me know if you have any trouble)
* Does validate presence, which effectively requires that your source column be present, so you might as well add a
check for that.
==== Coming Soon(ish)
* Generator to create a migration for your models
==== Feedback Welcome!
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.
Nick Zadrozny<br/>
nick@zadrozny.com (email/jabber/gtalk)<br/>
https://beyondthepath.com/
