Google Map problems


#1

I followed the setup from http://cartographer.rubyforge.org/
but keep getting this error -

NoMethodError in Sandbox#map

Showing app/views/layouts/sandbox.rhtml where line #4 raised:

You have a nil object when you didn’t expect it!
You might have expected an instance of Array.
The error occured while evaluating nil.[]

Extracted source (around line #4):

1:
2:
3: Admin: <%= controller.action_name %>
4: <%= gmaps_header %>
5:

…Full Trace…

#{RAILS_ROOT}/vendor/plugins/cartographer/lib/cartographer.rb:27:in
gmaps_header' #{RAILS_ROOT}/app/views/layouts/sandbox.rhtml:4:in_run_rhtml_layouts_sandbox’

Any help would be great! thx


#2

I had a similar problem. In my case, the issue was with keys.rb and my
host
name. Contrary to what the sample keys.rb led me to believe, the
hostname
command doesn’t return ‘localhost’ on my local system, or my public
domain
name on hostingrails.com. Instead, it returns ‘My-Computer.local’ and
‘[someserver].webserversystems.com’, respectively. Using the correct
host
names fixed the issue.

Alex.


#3

Great but I’m still unclear on what to use instead of ‘hostname.’


#4

You still use the hostname command, but you substitute the value that it
returns in the when clauses below. For example:

GOOGLE_MAPS_API_KEYS = case hostname.chomp # FIXME: this may not
work on
Windows?

when 'My-Computer.local'
  { 'directory/index' => 'ABQIAAAAAvd-Y2CbTw44IqBjXHWLGBTJw',
    'directory/search' => 'ABQIAAAAAvd-Y2CbTw44IqBjXHWLGBTJw',
    ...
  }

when 'servername.webserversystem.com'
  { 'directory/index' => 'laksjsdflkjsf',
    'directory/search' => 'sdlfkjdslkfjd',
    ...
  }

Alex.


#5

Chang Sau S. wrote:

Check out my JobMapper tutorial – it explains how to setup and use
cartographer. http://saush.com/blog/?page_id=48

Rob B. wrote:

#{RAILS_ROOT}/vendor/plugins/cartographer/lib/cartographer.rb:27:in
gmaps_header' #{RAILS_ROOT}/app/views/layouts/sandbox.rhtml:4:in_run_rhtml_layouts_sandbox’

Any help would be great! thx


Sau S.

http://blog.saush.com
http://www.projectible.com
http://jaccal.sourceforge.net

Great! Thank you both :slight_smile:


#6

Check out my JobMapper tutorial – it explains how to setup and use
cartographer. http://saush.com/blog/?page_id=48

Rob B. wrote:

#{RAILS_ROOT}/vendor/plugins/cartographer/lib/cartographer.rb:27:in
gmaps_header' #{RAILS_ROOT}/app/views/layouts/sandbox.rhtml:4:in_run_rhtml_layouts_sandbox’

Any help would be great! thx


Sau S.


http://www.projectible.com
http://jaccal.sourceforge.net