apneadiving / Google-Maps-for-Rails

Enables easy Google map + overlays creation in Ruby apps
https://apneadiving.github.io/
MIT License
2.26k stars 382 forks source link

'gmaps4rails' returns two empty divs #100

Closed dgutov closed 13 years ago

dgutov commented 13 years ago

I've generated the JSON string from the models, but when I pass it to gmaps4rails, it just returns a string with two divs.

 > @json[0..80]
=> "[{\"lng\": \"37.146216\", \"lat\": \"55.694972\"},\n{\"lng\": \"37.241626\", \"lat\": \"55.738261"
 > gmaps4rails(@json)
=> "\n\n<div class=\"map_container\"> \n  <div id=\"map\" class=\"gmaps4rails_map\"></div>\n</div>\n"

Relevant line from the model definition:

acts_as_gmappable :process_geocoding => false
apneadiving commented 13 years ago

The response is divided in 3 parts:

You've got the html from the helper and you should retrieve the rest by including yield :head and yield :scripts.

It's part if the installation instructions.

dgutov commented 13 years ago

Thanks, I didn't notice the the data part is also inside the "content_for :scripts" block.

Sorry for the false alarm.