Hi, I am new to Ruby on Rails. I am trying to integrate Google Map with Ruby on Rails, and I am totally stuck. I can initiate the map centered at a hardcoded lat and lng in my index view, with other locations displayed within 25 miles.
However, I am not sure how to update the current map with results from search query (which would be an address or zip code) from a user. From server message output, search action does find markers from different center point, but I can't seem to get them displayed in the current map. The following is my search form in index view. <% form_tag(search_path, :method => 'get') do %> <%= label_tag(:query, 'Search for:') %> <%= text_field_tag(:query) %> <%= submit_tag('Search') %> <% end %> The following is the route config. map.search 'search', :controller => 'places', :action => 'search' The following is search.rjs (I also hardcoded @marker in search controller to see if the map gets updated with a new marker). page << @map.clear_overlays page << @map.add_overlay(@marker) But, all I get is the following error... try { map.clearOverlays(); map.addOverlay(addInfoWindowToMarker(new GMarker(new GLatLng(75.89,-42.767),{title : "Update"}),"I have been placed through RJS",{})); } catch (e) { alert('RJS error:\n\n' + e.toString()); alert('map.clearOverlays();\nmap.addOverlay(addInfoWindowToMarker(new GMarker(new GLatLng(75.89,-42.767),{title : \"Update\"}),\"I have been placed through RJS\",{}));'); throw e } But, I think the real problem is not related to the javascript error. I am just not sure if this direction I am going is right......using search form, search action, and search.rjs. Updating just the map section of index view is missing, and I am not sure how to go about it. If anyone could help me out, I would very much appreciate it.... Thanks, -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---