Created
June 25, 2009 21:51
-
-
Save mrinterweb/136189 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
# The following responds to: | |
# /locations/nearby/45.513906/-122.645548 | |
# /locations/nearby/45.513906/-122.645548/100 | |
# /locations/nearby/45.513906/-122.645548/100/5 | |
# /locations/nearby/45.513906/-122.645548/100/5.xml | |
# The following urls work now: | |
# /locations/nearby/45.513906/-122.645548.xml | |
# /locations/nearby/45.513906/-122.645548/100.xml | |
# | |
# :range and :limit are intended to be optional | |
map.with_options( | |
:controller => 'locations', | |
:action => 'nearby', | |
:requirements => { | |
:lat => /-?\d+\.\d+/, | |
:lng => /-?\d+\.\d+/, | |
:range => /\d*/, | |
:limit => /\d*/ | |
}, | |
:range => 10, | |
:limit => 10 | |
) do |nearby| | |
nearby.connect '/locations/nearby/:lat/:lng.:format' | |
nearby.connect '/locations/nearby/:lat/:lng/:range.:format' | |
nearby.connect '/locations/nearby/:lat/:lng/:range/:limit.:format' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment