Search code examples
ruby-on-rails-3.1gmaps4rails

Google-Maps-For-Rails not showing map in Rails 3.1


I am trying to use the gem 'gmaps4rails'. I inserted all of the necessary code into my model and view, and I know that the geocoding is working. However, when I insert the code <%= gmaps4rails(@json) %> into my index.html.erb file, the map does not appear.

EDIT: I downgraded the version to 0.8.8, and I was able to run rails g gmaps4rails:install to get the layouts. Does version 0.9.1 have a different command for installing the layouts?


Solution

  • I was having the same problem (couldn't get the generator installing) and getting the 404 for gmaps4rails.js.

    The following steps worked (you had most of it).

    • I downgraded to 0.8.8;
    • ran the generator;
    • then copied the generated files from public/ to assets/;
    • changed back to version 0.9.1.

    and it worked fine after that (i.e. map showing).