Skip to content

Instantly share code, notes, and snippets.

@bastos
Forked from bmizerany/from.rb
Created December 12, 2008 15:49
Show Gist options
  • Save bastos/35164 to your computer and use it in GitHub Desktop.
Save bastos/35164 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