[英]How do I order the results of rails geocoder gem by something other than distance
[英]Rails Geocoder custom order result other than distance
我正在使用Geocoder( https://github.com/alexreisner/geocoder )來查找附近的商店,例如:Store.near([@ lat,@long],20)可以通過id對我的結果進行排序距離?
通過順序求解:Near方法中為false
另外,您可以使用reorder
而不是order
來對near
結果應用任何排序順序: Store.near([@lat, @long], 20).reorder(:id)
reorder
將替換先前范圍創建的order
聲明。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.