Closed samsondav closed 3 years ago
I am closing all issues that are more than 6 years old now, as the gem has had significant updates and is likely people with these old issues are no longer having the issues. If you are currently still experiencing this issue or need help feel free to submit a new issue, thank you.
Not sure if this is a bug in geokit-rails or ActiveRecord but I have a database query that uses by_nearby to sort locations by proximity. This works great if I append .first, .second etc to the query call.
It also gives expected behaviour if I use query[-1] to select the last record.
However, if I call query.last, it generates bad sql (presumably it tries to optimise by reversing the sort order, but this fails due to some complex math).
Here is the generated SQL:
This works fine:
This fails:
Not a problem as I said, I can use the array[-1] selector as a workaround, but perhaps it could be possible to fix in geokit-rails so that last returns the correct value?
-S