Class: Spree::PriceLists::Deactivate

Inherits:
Workflow
  • Object
show all
Defined in:
app/workflows/spree/price_lists/deactivate.rb

Overview

Takes a price list out of effect. Its prices stop applying immediately; nothing about them is discarded, so it can be activated again later.

Instance Method Summary collapse

Methods inherited from Workflow

#call, define_argument_readers, #errors, #halt!, hooks, inherited, model_name, #read_attribute_for_validation, #reject!, workflow_key

Methods included from ServiceModule::Base

#call, prepended

Methods included from Workflow::ControlFlow

#failure

Instance Method Details

#perform(price_list:) ⇒ Spree::ServiceModule::Result

Returns value is the price list.

Parameters:

Returns:



10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/workflows/spree/price_lists/deactivate.rb', line 10

def perform(price_list:)
  super

  run_hooks :validate

  ApplicationRecord.transaction do
    step :mark_inactive
    run_hooks :after_deactivate
  end

  success(price_list)
end