| CARVIEW |
Select Language
HTTP/2 302
server: nginx
date: Tue, 23 Dec 2025 18:43:52 GMT
content-type: text/plain; charset=utf-8
content-length: 0
x-archive-redirect-reason: found capture at 20100215095934
location: https://web.archive.org/web/20100215095934/https://github.com/thoughtbot/what
server-timing: captures_list;dur=0.890518, exclusion.robots;dur=0.063652, exclusion.robots.policy;dur=0.048790, esindex;dur=0.014130, cdx.remote;dur=57.958330, LoadShardBlock;dur=173.674919, PetaboxLoader3.datanode;dur=61.876000, PetaboxLoader3.resolve;dur=46.701954
x-app-server: wwwb-app210-dc8
x-ts: 302
x-tr: 277
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=0
set-cookie: wb-p-SERVER=wwwb-app210; 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 18:43:53 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:59:35 GMT
x-archive-orig-connection: close
x-archive-orig-status: 200 OK
x-archive-orig-etag: "efab4c4bdd2f65d0c61442c2d356dd11"
x-archive-orig-x-runtime: 166ms
x-archive-orig-content-length: 23243
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:59:34 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-20100215095709-00830-ia360906.us.archive.org.warc.gz
server-timing: captures_list;dur=0.687653, exclusion.robots;dur=0.024119, exclusion.robots.policy;dur=0.010233, esindex;dur=0.014034, cdx.remote;dur=17.201223, LoadShardBlock;dur=135.644133, PetaboxLoader3.datanode;dur=135.690458, load_resource;dur=298.664875, PetaboxLoader3.resolve;dur=261.157055
x-app-server: wwwb-app210-dc8
x-ts: 200
x-tr: 521
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
thoughtbot's what at master - GitHub
This service is courtesy of Pledgie.
thoughtbot / what
- Source
- Commits
- Network (0)
- 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:
Adds boolean instance methods for MIME type checking to Rails — Read more
jcarroll (author)
Fri Feb 22 12:07:16 -0800 2008
what /
| name | age | message | |
|---|---|---|---|
| |
MIT-LICENSE | Loading commit data... |
|
| |
README | ||
| |
Rakefile | ||
| |
init.rb | ||
| |
install.rb | ||
| |
lib/ | Wed Feb 20 08:46:15 -0800 2008 | refactoring git-svn-id: https://svn.thoughtbot... [jcarroll] |
| |
tasks/ | Mon Feb 18 20:31:47 -0800 2008 | created the what plugin git-svn-id: https://sv... [dcroak] |
| |
test/ | ||
| |
uninstall.rb |
README
What
====
What provides boolean query methods on Mime::Type instances
for the native Rails mime-types. You now have these methods
available from your controllers:
request.format.atom?
request.format.css?
request.format.csv?
request.format.html?
request.format.ics?
request.format.js?
request.format.json?
request.format.multipart_form?
request.format.rss?
request.format.text?
request.format.url_encoded_form?
request.format.xml?
request.format.yaml?
... and any custom mime types that you add in any environment specific config files.
Examples
========
# config/initializers/mime_types.rb
Mime::Type.register 'text/iphone', :iphone
# app/controllers/what_controller.rb
class WhatController < ApplicationController
before_filter :csv?, :iphone?
def index
render :text => 'index'
end
protected
def csv?
if request.format.csv?
redirect_to login_url
end
end
def iphone?
if request.format.iphone?
redirect_to login_url
end
end
end
What is especially powerful in combination with When.
# app/controllers/what_controller.rb
class WhatController < ApplicationController
before_filter :login, :if => :csv?
before_filter :login, :if => lambda { |controller| controller.request.format.iphone? }
def index
render :text => 'index'
end
protected
def csv?
request.format.csv?
end
def login
redirect_to login_url
end
end
Copyright (c) 2008 Dan Croak, Jared Carroll, and thoughtbot, inc. released under the MIT license

