Class: SpreeCmCommissioner::ProductEventIdToChildrenSyncer

Inherits:
BaseInteractor
  • Object
show all
Defined in:
app/interactors/spree_cm_commissioner/product_event_id_to_children_syncer.rb

Instance Method Summary collapse

Instance Method Details

#callObject

skip validation & callback like checking stock, etc.



6
7
8
9
10
11
12
13
# File 'app/interactors/spree_cm_commissioner/product_event_id_to_children_syncer.rb', line 6

def call
  event_id = product.event_id

  # rubocop:disable Rails/SkipsModelValidations
  product.line_items.find_each { |line_item| line_item.update_columns(event_id: event_id) }
  product.guests.find_each { |guest| guest.update_columns(event_id: event_id) }
  # rubocop:enable Rails/SkipsModelValidations
end