Search code examples
jqueryruby-on-rails-3fancyboxfancybox-2gmaps4rails

Fancybox and gmaps4rails not working on heroku


I have a Ruby on Rails site on Heroku which uses both Fancybox for images and Gmaps4Rails for showing a map with marker. Locally everything works fine, but on Heroku both Fancybox and Gmaps4Rails don't work, here is an example: http://mygroundhops.herokuapp.com/visits/204

Because both different javascript libraries are not working, my guess would be that there is something wrong with the asset pipeline. Any suggestions? Thanks!


Solution

  • Well, it turned out that using

    //= require_tree .
    

    made a mess of the order of all the javascript files. Probably the gmaps4rails files were loaded before jquery. By explicitly setting the order the issue was solved:

    //= require jquery
    //= require jquery_ujs
    //= require jquery.fancybox
    //= require jquery.fancybox.pack
    //= require bootstrap
    //= require bootstrap-dropdown
    //= require gmaps4rails.base
    //= require gmaps4rails.googlemaps