Skip to content
Snippets Groups Projects
Commit f00546ef authored by Laila Winner's avatar Laila Winner
Browse files

Pass location to ReverseGeocodeJob#perform

parent 7b145019
No related branches found
No related tags found
No related merge requests found
...@@ -14,17 +14,7 @@ ...@@ -14,17 +14,7 @@
class ReverseGeocodeJob < ActiveJob::Base class ReverseGeocodeJob < ActiveJob::Base
queue_as :high queue_as :high
def perform(location_id) def perform(location)
location = Location.where(id: location_id).first
if location.present?
reverse_geocode(location)
end
end
private
def reverse_geocode(location)
address = address(location) address = address(location)
if address.present? if address.present?
...@@ -32,6 +22,8 @@ class ReverseGeocodeJob < ActiveJob::Base ...@@ -32,6 +22,8 @@ class ReverseGeocodeJob < ActiveJob::Base
end end
end end
private
def address(location) def address(location)
Geocoder.address(location.coordinates) Geocoder.address(location.coordinates)
rescue => exception rescue => exception
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment