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?
gmaps4rails
is just a convenient shortcut for gmaps
with some default options.
Horizontally duplicated map is the default behavior of google maps depending on your map size and zoom level.