<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Geokit and named_scope</title>
	<atom:link href="http://www.napcsweb.com/blog/2009/08/11/geokit-and-named_scope/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.napcsweb.com/blog/2009/08/11/geokit-and-named_scope/</link>
	<description>professional web development and consulting</description>
	<lastBuildDate>Thu, 19 Aug 2010 15:30:25 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>By: Brian</title>
		<link>http://www.napcsweb.com/blog/2009/08/11/geokit-and-named_scope/comment-page-1/#comment-27388</link>
		<dc:creator>Brian</dc:creator>
		<pubDate>Wed, 07 Oct 2009 04:30:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.napcsweb.com/blog/?p=81#comment-27388</guid>
		<description>@NickD:

You&#039;re right. I extracted this code from an existing example and forgot to handle the geocoding within the method. The self.by_location method does the geolocation lookup if a string is passed. 

I like your example. Very simple.</description>
		<content:encoded><![CDATA[<p>@NickD:</p>
<p>You&#8217;re right. I extracted this code from an existing example and forgot to handle the geocoding within the method. The self.by_location method does the geolocation lookup if a string is passed. </p>
<p>I like your example. Very simple.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: NickD</title>
		<link>http://www.napcsweb.com/blog/2009/08/11/geokit-and-named_scope/comment-page-1/#comment-27386</link>
		<dc:creator>NickD</dc:creator>
		<pubDate>Tue, 06 Oct 2009 16:22:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.napcsweb.com/blog/?p=81#comment-27386</guid>
		<description>I found that I had to call MultiGeocoder.geocode(&quot;742 Evergreen Terrace, Springfield IL&quot;) first and pass that object to distance_sql.  distance_sql doesn&#039;t take in a straight address.

Here is my named scope:
named_scope :geocoded, lambda{ &#124;origin, distance&#124; distance_sql = self.distance_sql(MultiGeocoder.geocode(origin)); { :select =&gt; &quot;businesses.*, #{distance_sql} as distance&quot;, :conditions =&gt; &quot;#{distance_sql} &lt;= #{distance}&quot; } }</description>
		<content:encoded><![CDATA[<p>I found that I had to call MultiGeocoder.geocode(&#8220;742 Evergreen Terrace, Springfield IL&#8221;) first and pass that object to distance_sql.  distance_sql doesn&#8217;t take in a straight address.</p>
<p>Here is my named scope:<br />
named_scope :geocoded, lambda{ |origin, distance| distance_sql = self.distance_sql(MultiGeocoder.geocode(origin)); { :select =&gt; &#8220;businesses.*, #{distance_sql} as distance&#8221;, :conditions =&gt; &#8220;#{distance_sql} &lt;= #{distance}&quot; } }</p>
]]></content:encoded>
	</item>
</channel>
</rss>
