Ym4r cannot convert string to rails3

Here are some of my concerns:

I'm on Snow Leopard I have RVM installed (using the ruby1.9.2 installation) I use rails3 I installed ym4r using http://github.com/guilleiguaran/ym4r_gm (and followed the tutorial)

In any case, I added them to the 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!"))

then in my opinion:

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

well, actually 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

Display / Users / eumir / rails_apps / evo-lux / app / views / layouts / _map.html.haml, where line # 11 is raised:

cannot convert Ym4r :: GmPlugin :: Variable to String (Ym4r :: GmPlugin :: Variable # to_str gives Ym4r :: GmPlugin :: Variable)

Extracted source (around line # 11):

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

. ( ... ruby-debugger)

. ?

+3
2

RTFM. :

  • google maps v2 API
  • to_html , init html- , .
+1

​​ Variable map.rb .

def to_str  @variable + ";"

Array # * to_html, Ruby 1.9.2 to_str to_s .

+11

Source: https://habr.com/ru/post/1756358/


All Articles