gmaps4rails version 2 build method
- by BrainLikeADullPencil
I installed gmaps4rails for my Rails app, ran the generator, and required the two files like this in my application.js file, along with underscore.js
//= require underscore
//= require gmaps4rails/gmaps4rails.base
//= require gmaps4rails/gmaps4rails.googlemaps
adding, as instructed on github https://github.com/apneadiving/Google-Maps-for-Rails, these dependencies in layout.html.erb
When I tried to create the demo map from the github page with this code, I got an error that the object doesn't have a build method.
Uncaught TypeError: Object # has no method 'build'
handler = Gmaps.build('Google');
handler.buildMap({ provider: {}, internal: {id: 'map'}}, function(){
markers = handler.addMarkers([
{
"lat": 0,
"lng": 0,
"picture": {
"url": "https://addons.cdn.mozilla.net/img/uploads/addon_icons/13/13028-64.png",
"width": 36,
"height": 36
},
"infowindow": "hello!"
}
]);
handler.bounds.extendWith(markers);
handler.fitMapToBounds();
});
Indeed, when I look inside the base file that I require in the manifest file there is no build method for that object.
How does one create a map in the new version for gmaps4rails?