Class: ActiverecordReindex::AsyncAdapter::MassUpdateJob

Inherits:
ActiveJob::Base
  • Object
show all
Defined in:
lib/activerecord_reindex/async_adapter.rb

Instance Method Summary collapse

Instance Method Details

#perform(klass, ids, request_record_klass, request_record_id) ⇒ Object



35
36
37
38
39
40
41
42
43
# File 'lib/activerecord_reindex/async_adapter.rb', line 35

def perform(klass, ids, request_record_klass, request_record_id)
  klass = klass.constantize

  request_record = request_record_klass.constantize.find(request_record_id)

  klass.find(ids).each do |record|
    record.__elasticsearch__.update_document(request_record: request_record)
  end
end