# Google-geocode gem not giving an error

**URL:** <https://www.ruby-forum.com/t/google-geocode-gem-not-giving-an-error/191602>\
**Category:** Rails\
**Created:** [July 15, 2010, 5:35am UTC](https://www.ruby-forum.com/t/google-geocode-gem-not-giving-an-error/191602 "2010-07-15T05:35:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![gandhi-tush](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/5daacb/32.png) [@gandhi-tush](https://www.ruby-forum.com/u/gandhi-tush)\
**Post date:** [July 15, 2010, 5:35am UTC](https://www.ruby-forum.com/t/google-geocode-gem-not-giving-an-error/191602/1 "2010-07-15T05:35:20Z")

</div>

Hi,  
I doing an integration my rails application with google map. For that I  
have installed the “google-geocode (1.2.1)” gem. I have written  
following code to get the longitude and latitude of the address.

require ‘rubygems’  
require ‘google\_geocode’  
def index  
gg = GoogleGeocode.new “#{Api\_Key}”  
loc = gg.locate(‘Pune’)  
puts loc.inspect  
end

Whenever I running this code I getting following error  
“TypeError: can’t convert String into Integer  
from  
/usr/local/ruby/lib/ruby/gems/1.8/gems/google-geocode-1.2.1/lib/google\_geocode.rb:72:in  
`[]' from /usr/local/ruby/lib/ruby/gems/1.8/gems/google-geocode-1.2.1/lib/google_geocode.rb:72:in`check\_error’  
from  
/usr/local/ruby/lib/ruby/gems/1.8/gems/rc-rest-4.0/lib/rc\_rest.rb:128:in  
`get' from /usr/local/ruby/lib/ruby/gems/1.8/gems/google-geocode-1.2.1/lib/google_geocode.rb:51:in`locate’  
from (irb):7”

Can anyone tell me what is the wrong with my code?

Thanks,  
Tushar
