Class: SpreeCmCommissioner::EnsureEventForProductLineItemGuestsJob
- Inherits:
-
ApplicationJob
- Object
- ActiveJob::Base
- ApplicationJob
- ApplicationJob
- SpreeCmCommissioner::EnsureEventForProductLineItemGuestsJob
- Defined in:
- app/jobs/spree_cm_commissioner/ensure_event_for_product_line_item_guests_job.rb
Instance Method Summary collapse
Methods included from ApplicationJobDecorator
handle_deserialization_error, prepended
Instance Method Details
#perform ⇒ Object
4 5 6 7 8 9 10 11 |
# File 'app/jobs/spree_cm_commissioner/ensure_event_for_product_line_item_guests_job.rb', line 4 def perform Spree::Taxon.event.includes(:children_products).find_each do |event| event.children_products.where('event_id IS NULL OR event_id != ?', event.id).find_each do |product| product.update_columns(event_id: event.id) # rubocop:disable Rails/SkipsModelValidations ::SpreeCmCommissioner::ProductEventIdToChildrenSyncerJob.perform_later(product.id) end end end |