Skip to content

Instantly share code, notes, and snippets.

View tannerburson's full-sized avatar

Tanner Burson tannerburson

View GitHub Profile
@tannerburson
tannerburson / gist:1299388
Created October 19, 2011 19:24 — forked from anonymous/gist:1299378
routing sucks
routing:
resources :listings
match '/p/:secret_code' => 'listings#show', :as => "show_listing"
controller spec:
it "should redirect to the listing show" do
post :create, :listing => @attr
response.should redirect_to(show_listing_path(assigns(:secret_code)))
#!/usr/bin/env ruby
require 'rubygems'
gem 'rack', '=0.9.1'
gem 'thin', '=1.0.0'
require 'sinatra/base'
## To run this just run thin -R config.ru start
## The default tests pass, allowing the app to start. If the tests failed, the app would not even attempt to start.
##
## Wrap up our sample app in a class, this let's us keep the entire app
# NAME: authinabox
# VERSION: 1.01 (Dec 27, 2008)
# AUTHOR: Peter Cooper [ http://www.rubyinside.com/ github:peterc twitter:peterc ]
# DESCRIPTION: An "all in one" Sinatra library containing a User model and authentication
# system for both session-based logins OR HTTP Basic auth (for APIs, etc).
# This is an "all in one" system so you will probably need to heavily tailor
# it to your own ideas, but it will work "out of the box" as-is.
# COMPATIBILITY: - Tested on 0.3.2 AND the latest rtomayko Hoboken build! (recommended for the latter though)
# - NEEDS DataMapper!
# - Less work needed if you use initializer library -- http://gist.github.com/40238