Search code examples
ruby-on-railsruby-on-rails-3gmaps4rails

Differences between gmaps and gmaps4rails


I am able to show my markers when I use this:

<%= gmaps4rails(@my_json_data) %>

However, if I just change that line for this one:

<%= gmaps("markers" => { "data" => @my_json_data }) %>

And @my_json_data value is:

@my_json_data = '[{"description":"test","lat":"37.564486","lng":"-122.323672"}]'

The map is not focused where I have the marker(s). I have to zoom out and check where those are. When I zoom out, I can see the map duplicated horizontally too. Why is this happening?


Solution

  • gmaps4rails is just a convenient shortcut for gmaps with some default options.

    See source code.

    Horizontally duplicated map is the default behavior of google maps depending on your map size and zoom level.