title: def block in rake task
body: <p>I got <code>undefined local variable or method 'address_geo' for main:Object</code> with the following rake task. What's the problem with it?</p>
  
  <pre><code>include Geokit::Geocoders
  
  namespace :geocode do
    desc "Geocode to get latitude, longitude and address"
    task :all =&gt; :environment do
      @spot = Spot.find(:first)
      if @spot.latitude.blank? &amp;&amp; !@spot.address.blank?
        puts address_geo
      end
  
      def address_geo
        arr = []
        arr &lt;&lt; address if @spot.address
        arr &lt;&lt; city if @spot.city
        arr &lt;&lt; country if @spot.country
        arr.reject{|y|y==""}.join(", ")
      end
    end
  end
  </code></pre>