title: RoR: How to get lat and lng using geokit-rails
body: <p>I want to display a google maps centered at the user's location. I am willing to use <code>gmaps4rails</code> and <code>geokit-rails</code> gems, because I guess those are the best ones.</p>
  
  <p>What I have so far is the map initialization:</p>
  
  <pre><code>&lt;div style='width: 800px;'&gt;
    &lt;div id="map" style='width: 800px; height: 400px;'&gt;&lt;/div&gt;
  &lt;/div&gt;
  
  &lt;script&gt;
  $(document).ready(function(){
    handler = Gmaps.build('Google');
    handler.buildMap({ provider: {}, internal: {id: 'map'}}, function(){
      markers = handler.addMarkers([
        {
          "lat": 0,
          "lng": 0,
          "picture": {
            "url": "https://addons.cdn.mozilla.net/img/uploads/addon_icons/13/13028-64.png",
            "width":  36,
            "height": 36
          },
          "infowindow": "hello!"
        }
      ]);
      handler.bounds.extendWith(markers);
      handler.fitMapToBounds();
    });
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>which works fine. Now the problem is to get the latitude and longitud based on user IP. This is what I am trying, but I am getting no result. In the controller I try to get the location using geokit gem, but it fails:</p>
  
  <pre><code>def view
    @location = IpGeocoder.geocode('181.169.135.95') #I know here I should use `request.remote_ip`, but as I am on localhost I can't
  end
  </code></pre>
  
  <p>I got this from <a href="https://github.com/geokit/geokit-rails" rel="nofollow">geokit github</a>, but it is not working.</p>
  
  <blockquote>
    <p>You can obtain the location for an IP at any time using the geocoder
    as in the following example:</p>
    
    <p>location = IpGeocoder.geocode('12.215.42.19')</p>
    
    <p>where Location is a GeoLoc instance containing the latitude, longitude, city, state, and country code. Also, the success value is true.</p>
  </blockquote>
  
  <p>I am getting the following error: <code>uninitialized constant WineryController::IpGeocoder</code>. Can anyone explain me what does this mean, and how to go ahead? I suspect this might be something really stupid, but I am still a novice in rails.</p>