Re: [Rails] Same custom method validation with different fields of same type

2015-10-28 Thread botp
On Thu, Oct 29, 2015 at 4:45 AM, Rodrigo Lueneberg wrote: > def is_valid_coordinate? # searches local geo_codes table for valid > zip > coord = self.full_target_area_coordinate.to_str coord = self.to_str > match =

Re: [Rails] Same custom method validation with different fields of same type

2015-10-28 Thread tamouse pontiki
On Wed, Oct 28, 2015 at 3:45 PM, Rodrigo Lueneberg wrote: > How can I refactor this coordinate validation routine so that I can use > this method with other fields of the same type, for instance, with > "full_last_position" and also maintain the cleanliness of the code and

[Rails] Same custom method validation with different fields of same type

2015-10-28 Thread Rodrigo Lueneberg
How can I refactor this coordinate validation routine so that I can use this method with other fields of the same type, for instance, with "full_last_position" and also maintain the cleanliness of the code and avoiding repeating method code? class Provider < ActiveRecord::Base include