Search code examples
ruby-on-railsrubygoogle-mapsmapsgmaps4rails

How to Configure the Google Maps for Rails Map config file?


I'm using the GM4Rails Gem.

I'm very newbie to Rails and I'm trying to find the config file so I can get a HYBRID Google Maps instead of the ROADMAP.

I couldn't find the file: https://github.com/apneadiving/Google-Maps-for-Rails/wiki/Map

Is there anyway I can change the config?


Solution

  • You have to know that:

    <%= gmaps4rails(@json) %>
    

    is a shortcut for:

    <%= gmaps("map_options" => { "auto_adjust" => true},
              "markers"     => { "data" => @json }) 
     %>
    

    When you need to pass additional options, you have to use the gmaps helper. In your case:

    <%= gmaps("map_options" => { "auto_adjust" => true, "type" => "HYBRID" },
              "markers"     => { "data" => @json }) 
     %>
    

    As you saw many more options are available.