Best strategy for adding geo data to user

After creating a user record I want to ask Geocoder for lat/lan and store them in the same dataset.
What is the best way in Phoenix?
In Rails I would use something like: after_validation
Any links?
Thanks for help

in the same dataset.

Do you mean in the same table?

What database do you use? Postgres has several nice types provided with postgis extension. And there is bryanjos/geo to use it with ecto.

Instead of after_validation you can use Ecto.Multi.

1 Like

Yes, same table, same user
Postgis is new to me…may be second step. I try Geocoder.

  1. create_user
  2. fetch lat/lon data with Geocoder(user_address)
  3. update_user lat/lon fields