I am trying to use the geokit-rails3 gem for geolocation information in a rails application. I have a simple model:
class Location < ActiveRecord::Base
def lookup_ip_information(post_ip)
ip = post_ip
location = IpGeocoder.geocode(ip)
puts location.full_address
lat = location.lat
lng = location.lng
end
end
When I call this method with request.remote_ip
from my controller, it's throwing an error: uninitialized constant Location::IpGeocoder
I just had this issue and resolved it by entering the full
Geokit::Geocoders::IpGeocoder.geocode(request.remote_ip)
and that seemed to solve it for me.