I am using geocoder and have a model called Location. This models contains longitude, latitude, and address. What I would like is to give the option to the user to fill in either longitude and latitude or the address. If one of them is fill up then fill up the remaining information. So here what I did
before_validation :check
def check
if self.address.blank?
reverse()
else
geo()
end
end
def reverse
reverse_geocoded_by :latitude, :longitude,
:address => :address
after_validation :reverse_geocode
end
def geo
geocoded_by :address
after_validation :geocode
end
But i am getting the following undefined method reverse_geocoded_by
I am not sure what to do!