Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

geocoded_by address method not called on updating any field #1449

Open
jaswinder97 opened this issue Apr 27, 2020 · 2 comments
Open

geocoded_by address method not called on updating any field #1449

jaswinder97 opened this issue Apr 27, 2020 · 2 comments

Comments

@jaswinder97
Copy link

Expected behavior

It should update lat lng on updating any field change in geocoded_by address but only called on create callback of activerecord

Actual behavior

It doesn't geocode on activerecord update callbacks

Steps to reproduce

  • Declare model declarations as:
   class Location < ApplicationRecord
     ...
     # Geocoding
     geocoded_by :full_address, lookup: :google
     before_save :geocode

     def full_address
       [line_1, line_2, postcode, city, country].reject(&:blank?).join(', ')
     end
   end 
  • try updating any field in full_address like line_1 or line_2 or postcode of location.

Environment info

  • Geocoder version: geocoder (1.5.1)
  • Rails version: 'rails', '~> 5.0.3'
  • Database (if applicable): postgresql
  • Lookup (if applicable):
@wiemthebest
Copy link

I reproduce the bug, do you have found a solution please ?

@alexreisner
Copy link
Owner

This is difficult to debug without more information (I can't reproduce it). If the before_save callback is only being executed on object create, that's a Rails or application error, not a Geocoder bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants