I am using GeoIP gem to get the longtitude and latitude of an ip in Ruby 2.0 and Rails 4.0, but in the console.log line, there is an error.
undefined method `latitude' for nil:NilClass
<% @all.each do |item| %>
<% @geo = GeoIP.new("#{Rails.root}/public/GeoLiteCity.dat").city(item.ip) %>
console.log("<%= @geo.latitude %>");
var markerLatlng = new google.maps.LatLng("<%= @geo.latitude %>", "<%= @geo.longitude %>");
var marker = new google.maps.Marker({
position: markerLatlng,
title: "<%= item.referer %>",
draggable: false,
map: map
});
<% end %>