def block in rake task

Я получил undefined локальную переменную или метод 'address_geo' для main: Object со следующей задачей rake. В чем проблема ?

include Geokit::Geocoders

namespace :geocode do
  desc "Geocode to get latitude, longitude and address"
  task :all => :environment do
    @spot = Spot.find(:first)
    if @spot.latitude.blank? && !@spot.address.blank?
      puts address_geo
    end

    def address_geo
      arr = []
      arr << address if @spot.address
      arr << city if @spot.city
      arr << country if @spot.country
      arr.reject{|y|y==""}.join(", ")
    end
  end
end
40
задан clami219 6 August 2014 в 10:56
поделиться