search for: other_ar

Displaying 1 result from an estimated 1 matches for "other_ar".

Did you mean: other_arg
2011 Feb 08
0
favorite pattern for adding functionality to an AR?
..., say I have some gnarly trig functions for distance and bearing between pairs of latitude and longitude: === file: latlng.rb module LatLng def haversine_distance(lat1, lng1, lat2, lng2) ... end def bearing(lat1, lng1, lat2, lng2) ... end === EOF ... and I want to mix in haversine_distance(other_ar) and bearing(other_ar) methods into an ActiveRecord. The shim functions would look like this: === def haversine_distance(other_ar) haversine_distance(self.lat, self.lng, other_ar.lat, other_ar.lng) end def bearing(other_ar) bearing(self.lat, self.lng, other_ar.lat, other_ar.lng) end === BUT...