URL with decimals. How to allow in routes?

Hi,

I have a resource that can take latitue and longitude. I have defined those in the DB as:

t.decimal :lat, :precision => 15, :scale => 10 t.decimal :lng, :precision => 15, :scale => 10

I have set the route so I can pass those in a restful way:

  map.nearby '/messages/nearby/:lat/:lng/:range/',               :controller => 'nearbies',               :action => 'index',               :conditions => {:method => :get}

So I can pass a URL like: http://127.0.0.1.:3000/messages/nearby/0,4/1,3/73

However the 0,4 and 1,3 are strings and when they are used for latitude and longitude they become 0.0 and 1.0

I see two options:

1- Convert 0,4 to 0.4 (I need decimal, :precision => 15, :scale => 10) 2- Allow decimals in the URL (..messages/nearby/0.4/1.3/73)

Is option #2 possible? Any hints to realize any of them? I have not succeeded converting the string...

Thanks

1- Convert 0,4 to 0.4 (I need decimal, :precision => 15, :scale => 10)

Went for option #1:

fixlat = params[:lat].gsub(/[,]/, '.') fixlat.to_f

So far looks ok.

Cheers.