0

With Ruby Geocoder I am able to convert address to latitude and longitude and then display it with google static map. However, when trying to use gmap for rails I am getting a blank container.

view - html.erb Static Map

    <%= image_tag "http://maps.google.com/maps/api/staticmap?size=450x300&sensor=false&zoom=16&markers=#{@location.latitude}%2C#{@location.longitude}" %>

When trying to replace the static map with gmaps4rails I add the following

    <%= yield :scripts %> 
    <%= gmaps4rails(@json) %>

I also added the necessities in my controller and model. An empty container displays and I feel like it's just not reading the data. I played around with some things I read, but I may not be understanding. Can someone help enlighten me?

apneadiving
  • 114,565
  • 26
  • 219
  • 213
nil
  • 2,238
  • 1
  • 19
  • 28

1 Answers1

0

Can you please try with replace

this

<%= yield :scripts %> 
<%= gmaps4rails(@json) %>

with

<%= gmaps4rails(@json) %>
<%= yield :scripts %>

I also faced same issue before. Solution is put <%= yield :scripts %> at the last line of your file.

Thanks.

Swati
  • 842
  • 10
  • 26
  • This is an old post and was solved, but thanks. I should've had put solution, but I dont remember what it was – nil Nov 08 '13 at 19:20