Mayuresh Srivastava
Mayuresh Srivastava

Reputation: 1422

Geocoder gem 'rake geocode:all CLASS=Model' not working

I have a Ruby on Rails app with geocoder gem installed. I am trying to bulk geocode all rows (approx. 2500) in my database with rake geocode:all. When I run the command nothing happened. None of the rows were geocoded. Am I missing something here?

Model.rb

geocoded_by :fulladdress  
after_validation :geocode

def fulladdress                                         
  [address, city, state, zip].compact.join(",")  
end

Upvotes: 1

Views: 448

Answers (1)

stwienert
stwienert

Reputation: 3632

Just try to run outside of the Rake task manually (e.g. rails console or rails runner):

Model.find_each {|m| m.save! }

If you do it in development have a quick look over the outputted SQL Statements, if there lines with "UPDATE models SET lat=?, lon=? ..."

Upvotes: 2

Related Questions