Getting an empty space when trying to use gmaps4rails
So I followed the tutorial and screencast but can't seem to get this to work. I can see the div id's called map container and gmaps4rails_map where presumably, the map is supposed to be but nothing else.
I put in the yield :head
and yield :script
in the header and footer of the application layout view and @charger = Charger.all.to_gmaps4rails
(Charger is my model) in the chargers_helper.html.erb file (I want to use in User show view).
I also put <%= gmaps4rails(@charger) %>
in the show.html.erb view.
How do I get this to work?
-Update-
I just got it to work. To fix the problem I put in the @charger = ... code in a method in the helper and called the method instead of @charger.
Now the map shows up but I still cannot see the insert new marker code like in 开发者_如何学JAVAthe screencast - I don't need it for my app but am curious as to what happened to it.
In the screencast, I create model + controller with a scaffold generator. That's why I have ready to use links.
Besides, I create buttons during the screencast. Nothing is made behind the scene: the whole app is created from scratch :)
精彩评论