Module: Esse::AsyncIndexing::ActiveRecord::Model::ClassMethods
- Defined in:
- lib/esse/async_indexing/active_record.rb
Instance Method Summary collapse
-
#async_index_callback(index_repo_name, on: %i[create update destroy],, with: nil, **options, &block) ⇒ Object
Define callback on create/update/delete to push a job to the async indexing the document.
-
#async_update_lazy_attribute_callback(index_repo_name, attribute_name, on: %i[create update destroy],, **options, &block) ⇒ Object
Define callback on create/update/delete to push a job to the async update a lazy attribute.
Instance Method Details
#async_index_callback(index_repo_name, on: %i[create update destroy],, with: nil, **options, &block) ⇒ Object
Define callback on create/update/delete to push a job to the async indexing the document.
67 68 69 70 71 72 |
# File 'lib/esse/async_indexing/active_record.rb', line 67 def async_index_callback(index_repo_name, on: %i[create update destroy], with: nil, **, &block) [:service_name] = ::Esse::AsyncIndexing.service_name([:service_name]) Array(on).each do |event| esse_callback(index_repo_name, :async_indexing, on: event, with: with, **, &block) end end |
#async_update_lazy_attribute_callback(index_repo_name, attribute_name, on: %i[create update destroy],, **options, &block) ⇒ Object
Define callback on create/update/delete to push a job to the async update a lazy attribute.
83 84 85 86 87 |
# File 'lib/esse/async_indexing/active_record.rb', line 83 def async_update_lazy_attribute_callback(index_repo_name, attribute_name, on: %i[create update destroy], **, &block) [:attribute_name] = attribute_name [:service_name] = ::Esse::AsyncIndexing.service_name([:service_name]) esse_callback(index_repo_name, :async_update_lazy_attribute, identifier_suffix: attribute_name.to_sym, on: on, **, &block) end |