Ruby – YM4R cannot be converted to a string of rails3

This is some background of my question:

I am on Snow Leopard
I installed RVM (using ruby1.9.2-head to install )
I am using rails3
I installed ym4r using this http://github.com/guilleiguaran/ym4r_gm (and followed the tutorial)

Anyway, I added these to my Controller:

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

So these seem to me:

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

Actually I am using haml(this has Does it matter?)

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

The problem is that I keep getting one

display /Users/eumir/ rails_apps/evo-lux/app/views/layouts/_map.html.haml, where the 11th line raises:

Cannot convert Ym4r::GmPlugin::Variable to String(Ym4r::GmPlugin: Variable#to_str gives Ym4r::GmPlugin::Va riable)

The extracted source (line 11):

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

This is strange. I can’t double check with the debugger (this is Another error…My rails can’t find ruby-debugger)

So I’m really sad. Does it help?

The following functions need to be added to the class Variable in the mapping.rb of the plug-in.

def to_str
@variable”;”
end

Call Array#* in the #_html function, and Ruby 1.9.2 uses to_str instead of to_s to connect Value.

This is some background of my question:

I am on Snow Leopard
I installed RVM (using ruby1.9.2-head installation)
I am using rails3
I installed ym4r using this http://github.com/guilleiguaran/ym4r_gm (and follow the tutorial)

Anyway, I Add these to my controller:

@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!"))

So these look to me:

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

Actually I I am using haml (does it matter?)

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

The problem is that I keep getting one

p>

Display /Users/eumir/rails_apps/evo-lux/app/views/layouts/_map.html.haml, where the 11th line raises:

Ym4r::GmPlugin: Variable is converted to String(Ym4r::GmPlugin::Variable#to_str gives Ym4r::GmPlugin::Variable)

The extracted source (line 11):

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

It’s weird. I can’t double check with the debugger (this is another error…my rails can’t find ruby-debugger)

So I’m really sad. Yes Help?

The following functions need to be added to the class Variable in the mapping.rb of the plug-in.

def to_str
@variable”;”
End

Call Array#* in the #_html function, and Ruby 1.9.2 uses to_str instead of to_s to concatenate values.

Leave a Comment

Your email address will not be published.