Search code examples
ruby-on-railsruby-on-rails-3google-mapsgoogle-maps-api-3gmaps4rails

Gmap4rails: Render partial in Infowindow via model (not controller)


I'm able to render the infowindow partial via controller like this:

marker.infowindow render_to_string(:partial => "/layouts/map", :locals => { :object => person})  

But I want to render it via the model in:

def gmaps4rails_infowindow
 #code here  
end  

How do I do that?

1) I'm showing two types of records on my map and each one has a different color marker. So I want to mention somewhere in the map to tell user which marker denotes what.How to do this?

2) what is sidebar in gmaps4rail?

3) how to pass instance variables to the partial?


Solution

  • replace:

    marker.infowindow render_to_string(:partial => "/layouts/map", :locals => { :object => person})  
    

    with:

    marker.infowindow render_to_string(:partial => "/layouts/map", :locals => { :person => person})