1

I'm running into a "Gmaps is not defined" JS error on Heroku (maps load up okay locally). I know there are a lot of similar questions out there on this issue but I've tried all sorts of hacks from their suggestions but am still stuck. Any help would be awesome.

Loading up the view locally produces a map but on Heroku I get the Gmaps error and the map box is blank.

Application.js looks like

//= require twitter/bootstrap
//= require bootstrap
//= require jquery
//= require jquery_ujs
//= require gmaps4rails/gmaps4rails.googlemaps
//= require gmaps4rails/gmaps4rails.base
//= require_tree .

Application.html.erb has

  <%= stylesheet_link_tag    "application", :media => "all" %>
  <%= javascript_include_tag "application" %>
  <%= stylesheet_link_tag "gmaps4rails" %>
  <%= csrf_meta_tags %>

And I render <%= yield :scripts %> at the bottom of the body

I call <%= gmaps4rails(@json) %> in a view and the markers param is populating as expected.

Application.rb has the following settings (in addition to other unrelated ones):

config.assets.precompile << /(^[^_\/]|\/[^_])[^\/]*$/
config.encoding = "utf-8"
config.assets.enabled = true
config.assets.initialize_on_precompile = false
config.assets.version = '1.1'

production.rb has the following:

  config.cache_classes = true
  config.consider_all_requests_local       = false
  config.action_controller.perform_caching = true
  config.serve_static_assets = true
  config.assets.compress = true
  config.assets.compile = false
  config.assets.digest = true
  config.assets.initialize_on_precompile = false

I love using this gem but have really bashed my head on this issue for quite some time. Thanks.

srt32
  • 1,260
  • 1
  • 14
  • 27
  • Are you able to access /assets/application.js? You have to include 2 gems on heroku: http://stackoverflow.com/a/16571492/423384 – Josh Jun 09 '13 at 05:06
  • Did you resolve this problem? If so, how? – Sarp Kaya Sep 03 '14 at 11:35
  • I don't remember, unfortunately. I would check that you have the assets required properly in the manifest, there are no asset pipeline compilation issues, and you have the `rails12_factor` gem installed (assuming you are on Rails 4). Sorry I can't be more helpful! – srt32 Sep 03 '14 at 16:02

0 Answers0