Google Maps in rails 3
I already wrote a blog on how to use Google maps in rails. Earlier blog is supported in rails 2.3.x version.
To supoort rails 3 application , certain changes are required in plugin.
Here I will show you what are those changes required.
Download YM4R plugin :
rails plugin install https://github.com/rorcraft/ym4r_gm
1. Add following method in class Varible under gm_plugin/mapping.rb
def to_str @variable + “;” end
2. Use raw method for each google maps methods to avoid html contents.
<%= raw GMap.header %> <%= raw @map.to_html %> <%= raw @map.div(:width => 600, :height => 400) %>
4. Add Ym4r js in your layouts
<%=javascript_include_tag :defaults,"ym4r-gm"%>
5. Commented line no: 35 in ym4r/lib/gm_plugin/map.rb
# a << "<script src=\"/public/javascripts/ym4r-gm.js\" type=\"text/javascript\"></script>\n" unless options[:without_js]
I hope this blog helps you. Let me know if you still facing any problem.




