Skip to content

Instantly share code, notes, and snippets.

@bmizerany
Created December 10, 2008 22:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save bmizerany/34524 to your computer and use it in GitHub Desktop.
Save bmizerany/34524 to your computer and use it in GitHub Desktop.
get '/:id' do
@vent = Vent.get(params[:id])
erb :show
end
# show post
get '/:id.xml' do
@vent = Vent.get(params[:id])
builder :show
end
## Using ? will make the previous section optional
## NOTE the ? after the .
get '/:id.?:format?' do
@vent = Vent.get(params[:id])
case params[:format]
when 'xml'
builder :show
else
erb :show
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment