Ym4r无法转换为rails3的字符串

cor*_*ded 3 ruby google-maps rvm ruby-on-rails-3

这是我的问题的一些背景:

我在Snow Leopard上安装了RVM(使用ruby1.9.2-head安装)我使用的是rails3我使用这个http://github.com/guilleiguaran/ym4r_gm安装了ym4r (并按照教程)

无论如何,我将这些添加到我的控制器:

@map = GMap.new("map_div")
@map.control_init(:large_map => true,:map_type => true)
@map.center_zoom_init([75.5,-42.56],4)
@map.overlay_init(GMarker.new([75.6,-42.467],:title => "Hello", :info_window => "Info! Info!"))
Run Code Online (Sandbox Code Playgroud)

那么这些对我看来:

Test <%= raw(GMap.header) %>  <%= raw(@map.to_html) %>  <%= raw(@map.div(:width => 600, :height => 400)) %>  
Run Code Online (Sandbox Code Playgroud)

实际上我正在使用haml(这有关系吗?)

Test
= raw(GMap.header)
- unless @map.blank?
  = raw(@map.to_html)
#map{:style => "width: 600px; height: 400px"}
Run Code Online (Sandbox Code Playgroud)

问题是我不断得到一个

显示/Users/eumir/rails_apps/evo-lux/app/views/layouts/_map.html.haml,其中第11行引发:

不能将Ym4r :: GmPlugin :: Variable转换为String(Ym4r :: GmPlugin :: Variable#to_str给出Ym4r :: GmPlugin :: Variable)

提取的来源(第11行):

9:测试10:= raw(GMap.header)11:= raw(@ map.to_html)12:= raw(@ map.div(:width => 600,:height => 400))

这很奇怪.我不能用调试器仔细检查(这是另一个错误...我的rails无法找到ruby-debugger)

所以我真的有点难过.有帮助吗?

小智 11

The following function needs to be added to class Variable in mapping.rb of the plugin.

def to_str @variable + ";" end

Array#*gets called in the to_html function and Ruby 1.9.2 uses to_str instead of to_s to join the values.