Class: Spree::Catalogs::Deactivate
- Defined in:
- app/workflows/spree/catalogs/deactivate.rb
Overview
Takes an agreement out of effect. Its audience stops seeing its assortment and stops getting its prices; the catalog and everything it holds — assignments, terms, its price list — survive untouched, so activating again resumes exactly what was there.
Deactivating is never refused: an agreement that has to stop applying has to be able to stop, whatever state it is in.
Instance Method Summary collapse
-
#perform(catalog:) ⇒ Spree::ServiceModule::Result
Value is the catalog.
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
Methods included from Workflow::ControlFlow
Instance Method Details
#perform(catalog:) ⇒ Spree::ServiceModule::Result
Returns value is the catalog.
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/workflows/spree/catalogs/deactivate.rb', line 15 def perform(catalog:) super run_hooks :validate ApplicationRecord.transaction do step :mark_inactive run_hooks :after_deactivate end success(catalog) end |