Search code examples
javascriptruby-on-railsruby-on-rails-3ruby-on-rails-3.1gmaps4rails

Gmaps4Rails Gmaps.triggerOldOnload method not found javascript error


I'm using the amazing gem gmaps4rails in a Rails project. It works just fine on my local machine, but once deployed on Heroku's Cedar stack the javascript throws an error at window.onload = function() { Gmaps.triggerOldOnload(); Gmaps.loadMaps(); }; , complaining that triggerOldOnload doesn't exist on Gmaps. Again, it works fine locally.

Here is the entire script block in which the error appears:

<SCRIPT type="text/javascript" charset="utf-8">
Gmaps.map = new Gmaps4RailsGoogle();
Gmaps.load_map = function() {
Gmaps.map.map_options.auto_adjust = true;
Gmaps.map.initialize();
Gmaps.map.markers = [{"title":"Project 1","lat":18.71381,"lng":-72.35581},    {"title":"Project 2","lat":18.71567,"lng":-72.35603}];
Gmaps.map.markers_conf.do_clustering = true;
Gmaps.map.create_markers();
Gmaps.map.adjustMapToBounds();
Gmaps.map.callback();
};
Gmaps.oldOnload = window.onload;
 window.onload = function() { Gmaps.triggerOldOnload(); Gmaps.loadMaps(); };
</SCRIPT>

Thanks in advance for looking this over!


Solution

  • I guess you updated the gem but didn't rerun the command to copy the assets in your app.