Rails Pretty URL with Decimals

Posted by Kevin Sylvestre on Stack Overflow See other posts from Stack Overflow or by Kevin Sylvestre
Published on 2010-04-15T20:24:15Z Indexed on 2010/04/15 20:33 UTC
Read the original article Hit count: 311

Filed under:

I have a rails application that allows searches using longitude and latitude. I have added a 'pretty' route with:

map.connect 'stores/near/:longitude/:latitude', :controller => 'stores', :action => 'index'

This works for integer latitude and longitude values (http://localhost:3000/stores/near/-88/49) but fails for decimal values (http://localhost:3000/stores/near/-88.341/49.123) giving:

Routing Error

No route matches "/stores/near/-88/49.0" with {:method=>:get}

Any ideas how to use pretty URLs in rails with decimals?

© Stack Overflow or respective owner

Related posts about ruby-on-rails