Class: NotBackOrderableDefaultValidator

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 backorderable_default

Instance Method Summary collapse

Instance Method Details

#validate(record) ⇒ Object



3
4
5
6
# File 'app/models/spree/stock_location_decorator.rb', line 3

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