<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.3.3" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: to_json and Rails 2</title>
	<link>http://www.googlemapsbook.com/2008/02/13/to_json-and-rails-2/</link>
	<description>with PHP or Rails and AJAX: From Novice to Professional</description>
	<pubDate>Sat, 31 Jul 2010 16:14:54 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.3</generator>
		<item>
		<title>By: Michael</title>
		<link>http://www.googlemapsbook.com/2008/02/13/to_json-and-rails-2/#comment-123272</link>
		<dc:creator>Michael</dc:creator>
		<pubDate>Fri, 09 Apr 2010 07:41:55 +0000</pubDate>
		<guid>http://www.googlemapsbook.com/2008/02/13/to_json-and-rails-2/#comment-123272</guid>
		<description>"var spots = ;"

is what I meant...</description>
		<content:encoded><![CDATA[<p>&#8220;var spots = ;&#8221;</p>
<p>is what I meant&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael</title>
		<link>http://www.googlemapsbook.com/2008/02/13/to_json-and-rails-2/#comment-123271</link>
		<dc:creator>Michael</dc:creator>
		<pubDate>Fri, 09 Apr 2010 07:41:08 +0000</pubDate>
		<guid>http://www.googlemapsbook.com/2008/02/13/to_json-and-rails-2/#comment-123271</guid>
		<description>anybody who is trying to get the examples running on rails 3 beta:

rails 3 escapes erb by default. so make sure to use the raw method like this:

var spots = ;</description>
		<content:encoded><![CDATA[<p>anybody who is trying to get the examples running on rails 3 beta:</p>
<p>rails 3 escapes erb by default. so make sure to use the raw method like this:</p>
<p>var spots = ;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeff</title>
		<link>http://www.googlemapsbook.com/2008/02/13/to_json-and-rails-2/#comment-103456</link>
		<dc:creator>Jeff</dc:creator>
		<pubDate>Tue, 21 Apr 2009 02:23:29 +0000</pubDate>
		<guid>http://www.googlemapsbook.com/2008/02/13/to_json-and-rails-2/#comment-103456</guid>
		<description>Actually, never mind. I figured it out. Apparentally, the error I was getting was due to the loop that placed the markers on the map. I had to change the loop to look like:

for (i = 0; i &#60; stores.length; i++) {
			var store=stores[i].store;
			addMarker(store.lat, store.lng, store.name);
			
		}</description>
		<content:encoded><![CDATA[<p>Actually, never mind. I figured it out. Apparentally, the error I was getting was due to the loop that placed the markers on the map. I had to change the loop to look like:</p>
<p>for (i = 0; i &lt; stores.length; i++) {<br />
			var store=stores[i].store;<br />
			addMarker(store.lat, store.lng, store.name);</p>
<p>		}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeff</title>
		<link>http://www.googlemapsbook.com/2008/02/13/to_json-and-rails-2/#comment-103452</link>
		<dc:creator>Jeff</dc:creator>
		<pubDate>Tue, 21 Apr 2009 01:53:36 +0000</pubDate>
		<guid>http://www.googlemapsbook.com/2008/02/13/to_json-and-rails-2/#comment-103452</guid>
		<description>I must admit that I'm a little confused, too, with regards to the example for 4-15. I've changed it from:

var stores=;
to 
var stores=;

But it keeps giving me an "invalid argument" error.  Any ideas?</description>
		<content:encoded><![CDATA[<p>I must admit that I&#8217;m a little confused, too, with regards to the example for 4-15. I&#8217;ve changed it from:</p>
<p>var stores=;<br />
to<br />
var stores=;</p>
<p>But it keeps giving me an &#8220;invalid argument&#8221; error.  Any ideas?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Max Smart</title>
		<link>http://www.googlemapsbook.com/2008/02/13/to_json-and-rails-2/#comment-101494</link>
		<dc:creator>Max Smart</dc:creator>
		<pubDate>Tue, 07 Apr 2009 07:16:42 +0000</pubDate>
		<guid>http://www.googlemapsbook.com/2008/02/13/to_json-and-rails-2/#comment-101494</guid>
		<description>I am using rails 2.2.2 and am only on chapter 3. I had to make this change to application.js 

var marker=markers[i].attributes to var marker=markers[i].marker

and then it would pull the Markers already in the DB.  Thanks, I am thrilled with this book.


PS I do have a question. If I only wanted to allow ONE geocach site what would you recommend. This is what I did, but do not think it is a good idea.
(the goal is to allow a user to select where they are from, but I only
want to capture and store a single geocode - no addresses can be stored in the system)


added to bottom of appl.js


function oneTime() {
  removeListener(clicker)

}

window.onload = init;
window.onclick = oneTime;
window.onunload = GUnload;

in init() I changed the GEvent.addListener....

to

clicker = GEvent.addlistener...</description>
		<content:encoded><![CDATA[<p>I am using rails 2.2.2 and am only on chapter 3. I had to make this change to application.js </p>
<p>var marker=markers[i].attributes to var marker=markers[i].marker</p>
<p>and then it would pull the Markers already in the DB.  Thanks, I am thrilled with this book.</p>
<p>PS I do have a question. If I only wanted to allow ONE geocach site what would you recommend. This is what I did, but do not think it is a good idea.<br />
(the goal is to allow a user to select where they are from, but I only<br />
want to capture and store a single geocode - no addresses can be stored in the system)</p>
<p>added to bottom of appl.js</p>
<p>function oneTime() {<br />
  removeListener(clicker)</p>
<p>}</p>
<p>window.onload = init;<br />
window.onclick = oneTime;<br />
window.onunload = GUnload;</p>
<p>in init() I changed the GEvent.addListener&#8230;.</p>
<p>to</p>
<p>clicker = GEvent.addlistener&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Toby Seaman</title>
		<link>http://www.googlemapsbook.com/2008/02/13/to_json-and-rails-2/#comment-96697</link>
		<dc:creator>Toby Seaman</dc:creator>
		<pubDate>Tue, 03 Mar 2009 23:35:17 +0000</pubDate>
		<guid>http://www.googlemapsbook.com/2008/02/13/to_json-and-rails-2/#comment-96697</guid>
		<description>joinlee, thanks for your August 16th post.  I was completely stumped and unable to persuade my map to retrieve the points from the DB.  I had pinned it down to a to_json type problem, but got lost working out how to debug.  In the end it was a case of replacing .attributes with .marker.  thank you so much for that gem!</description>
		<content:encoded><![CDATA[<p>joinlee, thanks for your August 16th post.  I was completely stumped and unable to persuade my map to retrieve the points from the DB.  I had pinned it down to a to_json type problem, but got lost working out how to debug.  In the end it was a case of replacing .attributes with .marker.  thank you so much for that gem!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: chris</title>
		<link>http://www.googlemapsbook.com/2008/02/13/to_json-and-rails-2/#comment-87873</link>
		<dc:creator>chris</dc:creator>
		<pubDate>Tue, 20 Jan 2009 03:22:34 +0000</pubDate>
		<guid>http://www.googlemapsbook.com/2008/02/13/to_json-and-rails-2/#comment-87873</guid>
		<description>You should link this from the errata-- I only found this page after spending a bunch of time trying to figure out why listMarkers() in chapter 3 didn't work and eventually figuring it out myself.  I even came and looked at the errata page but it's not there.  I only got here after googling "rails to_json" once I realized there was a difference in the structure in the book vs. what I was getting back.

The upside: I learned more how to debug javascript and its interactions with rails.
the downside: it took more time than I would have liked because I don't know much javascript and the way it deals with objects.</description>
		<content:encoded><![CDATA[<p>You should link this from the errata&#8211; I only found this page after spending a bunch of time trying to figure out why listMarkers() in chapter 3 didn&#8217;t work and eventually figuring it out myself.  I even came and looked at the errata page but it&#8217;s not there.  I only got here after googling &#8220;rails to_json&#8221; once I realized there was a difference in the structure in the book vs. what I was getting back.</p>
<p>The upside: I learned more how to debug javascript and its interactions with rails.<br />
the downside: it took more time than I would have liked because I don&#8217;t know much javascript and the way it deals with objects.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: robert_d</title>
		<link>http://www.googlemapsbook.com/2008/02/13/to_json-and-rails-2/#comment-85878</link>
		<dc:creator>robert_d</dc:creator>
		<pubDate>Fri, 26 Dec 2008 18:48:33 +0000</pubDate>
		<guid>http://www.googlemapsbook.com/2008/02/13/to_json-and-rails-2/#comment-85878</guid>
		<description>@jeremy
Put
var stores = ;
in map.html.erb (as it is explained above). Next see Page Source in a web browser to see what is the value of stores.</description>
		<content:encoded><![CDATA[<p>@jeremy<br />
Put<br />
var stores = ;<br />
in map.html.erb (as it is explained above). Next see Page Source in a web browser to see what is the value of stores.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: robert_d</title>
		<link>http://www.googlemapsbook.com/2008/02/13/to_json-and-rails-2/#comment-85767</link>
		<dc:creator>robert_d</dc:creator>
		<pubDate>Thu, 25 Dec 2008 18:35:24 +0000</pubDate>
		<guid>http://www.googlemapsbook.com/2008/02/13/to_json-and-rails-2/#comment-85767</guid>
		<description>To see what Rails to_json function returns put this statement
in javascript file 
alert('request.responseText :' + request.responseText);</description>
		<content:encoded><![CDATA[<p>To see what Rails to_json function returns put this statement<br />
in javascript file<br />
alert(&#8217;request.responseText :&#8217; + request.responseText);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jeremy</title>
		<link>http://www.googlemapsbook.com/2008/02/13/to_json-and-rails-2/#comment-83456</link>
		<dc:creator>jeremy</dc:creator>
		<pubDate>Thu, 04 Dec 2008 19:17:24 +0000</pubDate>
		<guid>http://www.googlemapsbook.com/2008/02/13/to_json-and-rails-2/#comment-83456</guid>
		<description>I am trying to test your code in example 4-15 with rails 2.0. 

I am seeing a syntax error when using json.

In your updated example: you said to change the code to var stores=; to var stores=;. This is the same thing. :) I also used the new update on this site and it is different. 

var points=;

This is also throwing an error.</description>
		<content:encoded><![CDATA[<p>I am trying to test your code in example 4-15 with rails 2.0. </p>
<p>I am seeing a syntax error when using json.</p>
<p>In your updated example: you said to change the code to var stores=; to var stores=;. This is the same thing. :) I also used the new update on this site and it is different. </p>
<p>var points=;</p>
<p>This is also throwing an error.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
