-
Notifications
You must be signed in to change notification settings - Fork 382
Gmaps is not defined
Jon Kern edited this page Dec 2, 2013
·
1 revision
This error can happen in any javascript app, but it is particularly noticeable when trying to get gmaps4rails working with Zurb Foundation.
Uncaught ReferenceError: Gmaps is not defined
And the offending line of code:
handler = Gmaps.build('Google');
Benjamin points out:
Explanation is you put
= javascript_include_tag "application"
at the bottom of your html to meet Foundation's expectations. So every previous javascript will fail. Solution: you have to put your scripts after the files defining them.So AFTER
= javascript_include_tag "application"
, add:
= yield :scripts
And then whenever you need in a view:
- content_for :scripts do :javascript // Gmaps can be called safely here...
Check out this working example of Gmaps4Rails with Zurb for details.