Class: Rails::Contact::IndexContactJob
- Inherits:
-
ApplicationJob
- Object
- ActiveJob::Base
- ApplicationJob
- Rails::Contact::IndexContactJob
- Defined in:
- app/jobs/rails/contact/index_contact_job.rb
Instance Method Summary collapse
Instance Method Details
#perform(contact_id, remove: false) ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'app/jobs/rails/contact/index_contact_job.rb', line 6 def perform(contact_id, remove: false) backend = Search::Backends::Elasticsearch.new return backend.remove(contact_id) if remove contact = Contact.includes(:emails, :phones).find_by(id: contact_id) return if contact.nil? backend.create_index! backend.upsert(contact) end |