Closed dvrensk 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.
In
acts_as_mappable.rb
the Array#sort_by_distance_from method is documented like this:This method creates a "distance" attribute on each object, calculates the
distance from the passed origin, and finally sorts the array by the
resulting distance.
In the implementation, a "distance" attribute is created on the class or classes of all objects in the array, which means that henceforth, all objects of that class will #respond_to?:distance. Not what I expected, and quite confusing since it never shows up in development mode (when the classes are reloaded between requests).
If this is the intended behaviour, it would be great if it was correctly documented. If it is not the intended behaviour, using singleton methods could be a solution.