uninitialized constant Ruby
ruby
Solution
You need to do, as below as per the doc `Geokit::Geocoders::IpGeocoder` .
Geokit::Geocoders::IpGeocoder.geocode(ip.to_s())
The class `IpGeocoder` is defined inside the module `Geokit::Geocoders`. So to access the class you need to use full path to that class, which is `Geokit::Geocoders::IpGeocoder`, using scope resolution operator `::`.
Problem
I'm working on a ruby app that pinpoints your location given your ip address. I have run into a road block though. I've already searched on this site, but the solutions I've already found are too general. Here's the error: ``` uninitialized constant Place::IpGeocoder (NameError) ``` And the code I'm developing: ``` require 'socket' require 'geocoder' require 'geokit' class Place def get_location ip = UDPSocket.open {|s| s.connect("64.233.187.99", 1); s.addr.last} location = IpGeocoder.geocode(ip.to_s()) end end me=Place.new me.get_location ``` I already installed the gems. Do I need to create a instance of it or something like in java?