Class: NotPropagateAllVariantsValidator

Inherits:
ActiveModel::Validator
  • Object
show all
Defined in:
app/models/spree/stock_location_decorator.rb

Overview

Validates that the reserved stock location does not have propagate_all_variants

Instance Method Summary collapse

Instance Method Details

#validate(record) ⇒ Object



11
12
13
14
# File 'app/models/spree/stock_location_decorator.rb', line 11

def validate(record)
  return unless record.reserved_items && record.propagate_all_variants?
  record.errors[:propagate_all_variants] << "propagate_all_variants must be false for reserved stock locations"
end