Last active
April 23, 2020 14:27
-
-
Save Chocksy/27fc38dee31810f6eca0289690e4a530 to your computer and use it in GitHub Desktop.
Process ahoy visits geocode information. We can use this to retry previous visits that have no location data.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get all visits that have `ip` set and no `country`, `city`, `latitude` & `longitude` set. | |
# Schedule background jobs to process each visit and update it. | |
Visit.where.not(ip: nil).where(country: nil, city: nil, latitude: nil, longitude: nil).find_each { |visit| Ahoy::GeocodeJob.set(queue: Ahoy.job_queue).perform_later(visit) } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment