Changes to address aren't saved #208

Closed
danmaz74 opened this Issue May 13, 2012 · 2 comments

2 participants

@danmaz74

When the address in the model is changed, the map location isn't updated automatically - this is known and I found a solution on stackexchange.

But I wonder if it wouldn't be possible to add to the gem itself a solution like this: http://stackoverflow.com/a/10574422/855874

@apneadiving
Owner

I wouldn't add extra complexity to the gem for this purpose.

Concerning your solution, I don't like the idea to duplicate data in the db. You'd rather do something like (untested):

attr_accessor :latest_address

after_initialize :set_latest_address

before_validation :check_g4r_address

def set_latest_address
   self.latest_address = self.gmaps4rails_address
end

def check_g4r_address
   self.gmaps = false if self.latest_address != self.gmaps4rails_address
end
@danmaz74
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment