views:

41

answers:

1

I have rails application, which deals with some google map related stuff.the problem is , i have a table which contains latitude & longitude columns. the column types are "float". for some occasions i need to generate the query by the following:

clients.find_all_by_lat_and_lng(latvalue,lngvalue).

I gave the correct & existing lat & lng values to fetch the database value. but i can get only Empty.

I tried with difference dynamic finders like find_by_lat,find_by_lng i get only empty values from the query ...but data are exits in the table.

I guess the Float column type is the culprit here, i don't how to overcome this and get the values. Can one suggest me on this.

NOTE : if i work with same query in windows i get the values. my box is ubuntu here i can't get the values

A: 
clients.find(:all, :conditions => ["lat = ? and lng = ?",latvalue, lngvalue])

try this your model name is "clients" ??? or Client

No Luck, my model name is Client only. The client model has the hasmany association with Map model.so when get the map object. i tried with mapobject.clients..find(:all, :conditions => ["lat = ? and lng = ?",latvalue, lngvalue]).... But no luck
palani
map.clients.find(:all, :conditions => ["lat = ? and lng = ?",13.0481,80.2214]) ------------> failsClient.find(:all,:conditions =>["lat=? and lng = ?",13.0481,80.22114]) -------------- Fails ... its returns empty
palani