Problem using GeoKit plugin from rake task

I’m still learning rails and I’ve run into a problem that has me
baffled and google hasn’t been able to help.

I’m using the GeoKit plugin to handle the geocoding of one of my
models. The model has a method called do_geocode(addr) that takes an
address string (addr), does the geocoding and assigns the appropriate
attributes based on the response. I’ve tested this quite a bit using
my web interface and have had no problems. Now, though, I’m trying to
do geocoding from a rake task, and this method always mysteriously
fails. The rake task reads in an address string from a file and calls
go_geocode on the model object.

Are rake tasks not able to utilize the full functionally of models
that have plugin functionality mixed in? The rake task code is
included below:

require ‘csv’

namespace :util do
desc ‘Import CSV file of stuff’
task(:import => :environment) do
CSV::Reader.parse(’./lib/tasks/test.csv’, ‘r’)) do |row|
store = do |c| = row[0] = row[1]
addr = row[2]

  if store.valid? # It is never valid because do_geocode always

puts ‘Store is valid’
store.errors.each_full{ |msg| puts msg }