views:

88

answers:

1

I'm not getting any undefined constant errors or anything, so I know the plugin is at least installed. The page shows up, but all there is is an empty div tag:

<div id="map" style="width:400px;height:300px" ></div>

...and no map.

Controller:

@user = User.find_by_email(session[:email])
@tickets = Ticket.find(:all, :origin => [@user.lat, @user.lng], :within => 60, :order => 'distance' ) 

@map = GMap.new("map")
@map.center_zoom_init([@user.lat, @user.lng], 5)

View (note: I'm not calling any javascript tags):

<%= @map.div(:width => 400, :height => 300) %>

From the view... debug(@map) (x's are actual numbers)

--- !ruby/object:Ym4r::GmPlugin::GMap 
container: map
global_init: []

init: []

init_begin: 
- !ruby/object:Ym4r::GmPlugin::Variable 
  variable: map.setCenter(new GLatLng("xxxxxxx","-xxxxx"),5)
init_end: []

variable: map

The config/gmaps_api_key.yml has a key generated from localhost:3000

Anyone know what I'm doing wrong?

A: 

Answered. For those searching through the archives, you need to make sure you have the following in the view:

<%= @map.to_html %>
<%= @map.div(:width => 600, :height => 400) %>

As well as:

<%= GMap.header %>

preferably in your header file.

Kevin