Class: Esse::AsyncIndexing::Actions::UpdateLazyDocumentAttribute

Inherits:
Object
  • Object
show all
Defined in:
lib/esse/async_indexing/actions/update_lazy_document_attribute.rb

Class Method Summary collapse

Class Method Details

.call(index_class_name, repo_name, attr_name, ids, options = {}) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/esse/async_indexing/actions/update_lazy_document_attribute.rb', line 5

def self.call(index_class_name, repo_name, attr_name, ids, options = {})
  _index_class, repo_class = CoerceIndexRepository.call(index_class_name, repo_name)
  kwargs = Esse::HashUtils.deep_transform_keys(options, &:to_sym)

  attr_name = repo_class.lazy_document_attributes.keys.find { |key| key.to_s == attr_name.to_s }
  repo_class.update_documents_attribute(attr_name, ids, **kwargs)
  ids
end