I am trying to add Google Maps to my page using YM4R/GM. As a regular submit using form_tag
everything works, so I know I didn't mess that part up.
But using form_remote_tag
I end up with nothing inside my update div. I tested with rendering text so the right method is being executed and YM4R/GM is returning the Google Maps KML. But the map is not being displayed.
My form tag:
<% form_remote_tag(:url => {:controller => "home", :action => "search"}, :update => "map_div") do %>
The search method specified as the form's action:
def search
location = GeoKit::Geocoders::MultiGeocoder.geocode(params[:address])
@map = GMap.new("map_div")
@map.control_init(:large_map => true,:map_type => true)
@map.center_zoom_init([location.lat,location.lng],11)
render :partial => 'map'
end
Is it correct to place the div to be updated inside of a partial, and then render that partial?
Am I overcomplicating this, or going about it the wrong way? I know the YM4R/GM code is being executed as I see Google's KML output. And I wonder if the problem is related the XML/KML response? Is Rails interpreting the response as XML rather than HTML?