Class: MySQL::Search::Jobs::UpdaterJob
- Inherits:
-
ActiveJob::Base
- Object
- ActiveJob::Base
- MySQL::Search::Jobs::UpdaterJob
- Defined in:
- lib/mysql/search/jobs/updater_job.rb
Overview
Updates the search index for a given full-text searchable model based on an associated model’s changes.
Instance Method Summary collapse
Instance Method Details
#perform(full_text_searchable_name, associated_name, associated_id, association_path) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/mysql/search/jobs/updater_job.rb', line 10 def perform(full_text_searchable_name, associated_name, associated_id, association_path) associated_model = associated_name.constantize.find_by(id: associated_id) return if associated_model.nil? ::MySQL::Search::Updater.new( full_text_searchable: full_text_searchable_name.constantize, associated_model: associated_model, association_path: association_path ).update end |