sql_for_area = QuadTile.sql_for_area(gc.bounds(radius), "home_")
sql_for_distance = gc.sql_for_distance("home_lat", "home_lon")
nearby = User.active.identifiable
sql_for_area = QuadTile.sql_for_area(gc.bounds(radius), "home_")
sql_for_distance = gc.sql_for_distance("home_lat", "home_lon")
nearby = User.active.identifiable
.where(sql_for_area)
.where("#{sql_for_distance} <= ?", radius)
.order(Arel.sql(sql_for_distance))
.where(sql_for_area)
.where("#{sql_for_distance} <= ?", radius)
.order(Arel.sql(sql_for_distance))