开发者

Rails Geocoder Function

开发者 https://www.devze.com 2023-04-11 11:48 出处:网络
With the geocoder gem, if I wanted to find pictures nearby one particular picture by a mile I could do开发者_开发知识库 pictures.nearby(1) but what if I had a user with a location and wanted to find p

With the geocoder gem, if I wanted to find pictures nearby one particular picture by a mile I could do开发者_开发知识库 pictures.nearby(1) but what if I had a user with a location and wanted to find pictures nearby my user, how would I do that


Instead of nearby() you can use

Pictures.near([u.lat, u.lon], 1)    # venues within 1 miles of a user

See GitHub/geocoder

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号