| CARVIEW |
Select Language
HTTP/2 302
server: nginx
date: Thu, 25 Dec 2025 06:27:54 GMT
content-type: text/plain; charset=utf-8
content-length: 0
x-archive-redirect-reason: found capture at 20090609032146
location: https://web.archive.org/web/20090609032146/https://github.com/mbleigh/from_param
server-timing: captures_list;dur=0.586097, exclusion.robots;dur=0.046363, exclusion.robots.policy;dur=0.036658, esindex;dur=0.009172, cdx.remote;dur=12.531818, LoadShardBlock;dur=319.067994, PetaboxLoader3.resolve;dur=50.455368, PetaboxLoader3.datanode;dur=77.166209
x-app-server: wwwb-app213-dc8
x-ts: 302
x-tr: 355
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=0
set-cookie: wb-p-SERVER=wwwb-app213; 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 301
server: nginx
date: Thu, 25 Dec 2025 06:27:55 GMT
content-type: text/html; charset=utf-8
content-length: 114
x-archive-orig-server: nginx/0.6.31
x-archive-orig-date: Tue, 09 Jun 2009 03:21:45 GMT
x-archive-orig-connection: close
x-archive-orig-status: 301 Moved Permanently
location: https://web.archive.org/web/20090609032146/https://github.com/mbleigh/from_param/tree/master
x-archive-orig-x-runtime: 15ms
x-archive-orig-cache-control: no-cache
x-archive-orig-content-length: 114
cache-control: max-age=1800
memento-datetime: Tue, 09 Jun 2009 03:21:46 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: 52_10_20090608213952_crawl102-c/52_10_20090609032107_crawl101.arc.gz
server-timing: captures_list;dur=0.572640, exclusion.robots;dur=0.018826, exclusion.robots.policy;dur=0.009289, esindex;dur=0.011230, cdx.remote;dur=10.106125, LoadShardBlock;dur=393.267669, PetaboxLoader3.resolve;dur=304.139888, PetaboxLoader3.datanode;dur=217.525588, load_resource;dur=189.173830
x-app-server: wwwb-app213-dc8
x-ts: 301
x-tr: 618
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=0
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: Thu, 25 Dec 2025 06:27:56 GMT
content-type: text/html; charset=utf-8
x-archive-orig-server: nginx/0.6.31
x-archive-orig-date: Tue, 09 Jun 2009 03:21:45 GMT
x-archive-orig-connection: close
x-archive-orig-status: 200 OK
x-archive-orig-x-runtime: 131ms
x-archive-orig-etag: "15f1ef01de072f5d4a252626ebc90227"
x-archive-orig-cache-control: private, max-age=0, must-revalidate
x-archive-orig-content-length: 19822
x-archive-guessed-content-type: text/html
x-archive-guessed-charset: utf-8
memento-datetime: Tue, 09 Jun 2009 03:21:46 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: 52_10_20090608213952_crawl102-c/52_10_20090609032107_crawl101.arc.gz
server-timing: captures_list;dur=0.490040, exclusion.robots;dur=0.015543, exclusion.robots.policy;dur=0.007395, esindex;dur=0.010051, cdx.remote;dur=13.233438, LoadShardBlock;dur=516.109874, PetaboxLoader3.datanode;dur=74.809396, PetaboxLoader3.resolve;dur=153.859466, load_resource;dur=63.288964
x-app-server: wwwb-app213-dc8
x-ts: 200
x-tr: 634
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=0
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
mbleigh's from_param at master - GitHub
This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
| Description: | Rails plugin that adds a from_param class method to ActiveRecord::Base for simple URL-based fetching. |
| Homepage: | https://mbleigh.lighthouseapp.com/projects/10478-from-param |
| Clone URL: |
git://github.com/mbleigh/from_param.git
Give this clone URL to anyone.
git clone git://github.com/mbleigh/from_param.git
|
| name | age | message | |
|---|---|---|---|
| |
.gitignore | Sat Apr 26 20:10:57 -0700 2008 | Complete rewrite to include automatic storing a... [mbleigh] |
| |
README | Tue Apr 29 06:20:29 -0700 2008 | Updated README resources. [mbleigh] |
| |
init.rb | Sat Apr 26 20:10:57 -0700 2008 | Complete rewrite to include automatic storing a... [mbleigh] |
| |
lib/ | Sat Apr 26 20:10:57 -0700 2008 | Complete rewrite to include automatic storing a... [mbleigh] |
| |
spec/ | Sat Apr 26 20:10:57 -0700 2008 | Complete rewrite to include automatic storing a... [mbleigh] |
FromParam
=========
This plugin is an addition to ActiveRecord::Base that establishes a better
convention for finding records based on parameters. It adds a "from_param" class
method to ActiveRecord::Base as a convention for fetching a model from a URL
parameter. By default it will find a record based on the to_i of the passed in
parameter, but storing a parameter in a column is where it becomes especially useful.
If you create a 'param' column in your table (or any other column using set_param_column),
the to_param of your record will automatically be saved to that column whenever
you save the record, and you will be able to retrieve it using just a simple
Model.from_param call with the generated to_param. It is probably wise to add an index
to the param column if you use one.
It's time to move away from generated-key-dependence, and this plugin is an attempt
to make that easy, painless, and work easily within the existing systems.
Example
=======
# default behavior
class User < ActiveRecord::Base
def to_param
"#{id}-#{first_name.downcase}-#{last_name.downcase}"
end
end
class UsersController < ApplicationController
# GET /users/1-bobby-mcfarin
def show
@user = User.from_param(params[:id]) # => <User id=1 first_name="Bobby" last_name="McFarin">
end
end
# using a 'param' column, in this case 'slug'
class Post < ActiveRecord::Base
set_param_column "slug" # defaults to "param"
def to_param
"#{created_at.strftime("%Y-%m-%d")}-#{title.gsub(" ","-").downcase.gsub(/[^a-z0-9-]/,"")}"
end
end
class PostsController < ApplicationController
# GET /posts/2008-04-26-from-param-plugin-released
@post = Post.from_param(params[:id]) # => <Post title="From Param: Plugin Released" created_at="2008-04-26">
end
Resources
=========
GitHub: https://github.com/mbleigh/from_param
Lighthouse: https://mbleigh.lighthouseapp.com/projects/10478-from-param
Copyright (c) 2007 Michael Bleigh (https://mbleigh.com/) and Intridea Inc. (https://intridea.com/), released under the MIT
license
This feature is coming soon. Sit tight!







