Created
December 10, 2008 22:46
-
-
Save bmizerany/34524 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## 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