0
ich habe diesen Code:Rubin: Sortieren Array von einem Foat Feld
response = Place.all
nearPlaces = []
for el in response
distance = el.distance_to([41.9097306,12.2558141])
if distance < 20
el.distance = distance
nearPlaces.push(el)
end
end
orderPlaces = nearPlaces.sort_by{|e| e[:distance]}
Aber das Array sortiert nicht durch Entfernung eingereicht ... irgendwelche Vorschläge?
ich habe diesen Fehler => 'Syntaxfehler, unerwartete &' – SaroVin
@SaroVin es ist unmöglich :) –
mehr Details => '_controller.rb: 23: Syntaxfehler, unerwartete & orderPlaces = nearPlaces.sort_by { &: distance}^' – SaroVin