Has anyone done this? I'm confused at how I can make this work, first off I have my user model
Geocoding with it works fine in IRB, just can't figure out how to get it to work in my project.
Trying to use some examples from the readme here: http://github.com/andre/geokit-rails/tree/master.
Anyhow here is what I have:
class User < ActiveRecord::Base
# geokit
acts_as_mappable
after_save :locate
def locate
location = Geokit::Geocoders::MultiGeocoder.geocode("12.12.12.12")
end
end
This corresponds with my save action in my userController
, I need to do this after save because authlogic provides the IP after it saves the user or session. I think eventually I'll make it a background process, but till then how can I get this to work? I have a location column in the user model that I'll store the results of geocode()
Also right now I just have some arbitrary IP address "12.12.12.12" but it should actually be current_login_ip