1. Computing

Sinatra URL Matching


When looking for a handler for a URL, Sinatra will look through each handler you've defined in the order you've defined them and use the first handler it finds that meets the criteria. For this reason, you should put your most specific handlers on top, and your most vague handlers on the bottom. You also have to be careful not to inadvertently hide any of your handlers by placing a handler with a badly designed regular expression or wildcard above it.

©2014 About.com. All rights reserved.