The reason is quite simple: partial contains a lot of javascript that you cannot load and execute in this way.
Therefore, you cannot use RJS there.
The correct way is UJS: get data with an AJAX call and display the result. In the following code, I am using jQuery.
In your opinion, add:
//include google script <script type="text/javascript" src='http://maps.google.com/maps/api/js?sensor=false&libraries=geometry'></script> //include gmaps4rails javascript <%=javascript_include_tag 'gmaps4rails' %> <script type="text/javascript" charset="utf-8"> </script> <div id="map_container"> <div id="gmaps4rails_map"></div> </div> <button type="button" id="ajax_map">Ajax Map</button>
Add the following class to your CSS:
#map-container { width: 800px; } #gmaps4rails_map { width: 800px; height: 400px; }
source share