I followed the instruction on github to install everything. (Gmaps4Rails-github)
The problem is that the map is blank, I only see the border of the map from the css.
Model:
class Recipe
include Mongoid::Document
include Gmaps4rails::ActsAsGmappable
acts_as_gmappable
field :name, :type => String
field :city, :type => String
field :country, :type => String
field :latitude, :type => Float
field :longitude, :type => Float
field :gmaps, :type => Boolean
def gmaps4rails_address
"#{self.city}, #{self.country}"
end
end
Controller:
class RecipesController < ApplicationController
def index
@location = Recipe.all.to_gmaps4rails
end
end
View:
= gmaps4rails(@location)
@location has the lat and lng in an array like
[{"lat":13.055363,"lng":47.811886},{"lat":13.055363,"lng":47.811886}]
The required JS and CSS files are getting loaded: gmaps4rails.base.js, gmaps4rails.googlemaps.js, gmaps4rails.bing.js, gmaps4rails.mapquest.js, gmaps4rails.openlayers.js, gmaps4rails.css
I don't get any errors in the server log or in the JS console. I don't know what I'm doing wrong here.
Any suggestion would be really helpful! Thanks!
I can't see any mention of:
<%= yield :scripts %>
in your code here. This is mandatory though!