# YM4R - convert variable to string error

**URL:** <https://www.ruby-forum.com/t/ym4r-convert-variable-to-string-error/194017>\
**Category:** Rails\
**Created:** [August 28, 2010, 2:31am UTC](https://www.ruby-forum.com/t/ym4r-convert-variable-to-string-error/194017 "2010-08-28T02:31:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ARF](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/bc8723/32.png) [@ARF](https://www.ruby-forum.com/u/ARF)\
**Post date:** [August 28, 2010, 2:31am UTC](https://www.ruby-forum.com/t/ym4r-convert-variable-to-string-error/194017/1 "2010-08-28T02:31:04Z")

</div>

Rails 2.3.8, ruby 1.9.2.0, rubygems 1.3.7, ym4r-0.6.1, ym4r\_gm (http://  
[GitHub - ewildgoose/ym4r\_gm: My copy of the subversion repo at svn://rubyforge.org/var/svn/ym4r/Plugins/GM/trunk/ym4r\_gm](http://github.com/ewildgoose/ym4r_gm)).

Help?

I keep getting the following error:

ActionView::TemplateError (can’t convert Ym4r::GmPlugin::Variable to  
String (Ym4r::GmPlugin::Variable#to\_str gives  
Ym4r::GmPlugin::Variable)) on line #3 of app/views/gpspoints/  
show.html.erb:

1: src=“[Google Maps](http://maps.google.com/maps)?  
file=api&v=2&key=ABQIAAAA3Nm6v1pCMGUPdARN6pwe\_xTJQa0g3IQ9GZqIMmInSLzwtGDKaBS7wWc7Vg3TkBH6bFVCpYKd7154Yg”

2: \<%= GMap.header %\>  
3: \<%= @map.to\_html %\>  
4: \<%= @map.div(:width =\> 600, :height =\> 400) %\>

I believe the @map.to\_html call is failing.

I ran the code on the console and the @map.control\_init(:large\_map =\>  
true,:map\_type =\> true) call returned “nil”. I am new to RoR - - I  
do not know if the ‘nil’ behavior is to be expected. I was curious  
because the latter call appears to build the array for the  
@map.to\_html call.

This is very frustrating; I have the midlet running and datastore  
complete in my N95 and the mySQL database under RoR ready . … but,  
the whole point is to display the GPS from the phone on the map.  
Arrrghhhh!

If anyone has any thoughts, I would apprecate your guidance.

Beev

---

<div class="post-metadata">

**Author:** ![ARF](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/bc8723/32.png) [@ARF](https://www.ruby-forum.com/u/ARF)\
**Post date:** [September 6, 2010, 4:39pm UTC](https://www.ruby-forum.com/t/ym4r-convert-variable-to-string-error/194017/2 "2010-09-06T16:39:42Z")

</div>

I had the same problem.

In mapping.rb of the plugin, add this function to class Variable

def to\_str  
@variable + “;”  
end

Appears to work fine after this fix.

Dave
