Thush-Fdo
Thush-Fdo

Reputation: 514

"Google is not defined" error on ruby on rails

I have a html and js file (maps_scripts.js) in which I have defined all the google maps function related to the mentioned html page. These two are working really fine.

I've been assigned to include these files to jruby on rails project developed by someone else.

So far these are the steps I took.

  1. copied maps_scripts.js file to \app\assets\javascripts
  2. copied related marker images to \app\assets\images
  3. added

    <%= javascript_include_tag 'https://maps.googleapis.com/maps/api/js?key=my_key&libraries=places' %> "
    

    to my html.erb page

  4. include

    <%= javascript_include_tag 'map_scripts.js', 'data-turbolinks-track' => true %>
    

    to my html.erb page

Question

I'm getting

 Uncaught ReferenceError: google is not defined at map_scripts.self-09044ded37604e5a1f367207911e2c79370a307b67a4be3178923d19f555011c.js:4

Note : I have several

   google.maps.* 

calls in the maps_scripts.js file. For an instance

  1. google.maps.MarkerImage
  2. google.maps.Size
  3. google.maps.Map etc.

Upvotes: 0

Views: 533

Answers (1)

neevany
neevany

Reputation: 128

Either you are missing a script or order of the scripts in map_scripts.js is wrong. try changing the order.

Upvotes: 1

Related Questions