Forum: Ruby on Rails Google Map problems

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Rob B. (Guest)
on 2006-05-16 15:03
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: <html>
2: <head>
3:   <title>Admin: <%= controller.action_name %></title>
4:  <%= gmaps_header %>
5:   </head>

....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
Alex Lynch (Guest)
on 2006-05-16 15:28
(Received via mailing list)
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.
Rob B. (Guest)
on 2006-05-16 15:37
Great but I'm still unclear on what to use instead of 'hostname.'
Alex Lynch (Guest)
on 2006-05-16 15:59
(Received via mailing list)
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.
Chang Sau S. (Guest)
on 2006-05-16 17:29
(Received via mailing list)
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
Rob B. (Guest)
on 2006-05-16 18:46
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 :)
This topic is locked and can not be replied to.