[英]Rails Geocoder custom order result other than distance
我正在使用Geocoder( https://github.com/alexreisner/geocoder )来查找附近的商店,例如:Store.near([@ lat,@long],20)可以通过id对我的结果进行排序距离?
通过顺序求解:Near方法中为false
Also you can use reorder
instead of order
to apply any sort order on near
results: Store.near([@lat, @long], 20).reorder(:id)
另外,您可以使用
reorder
而不是order
来对near
结果应用任何排序顺序: Store.near([@lat, @long], 20).reorder(:id)
The reorder
replaces the order
statement created by the previous scopes. reorder
将替换先前范围创建的order
声明。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.