Class: ReservedStockLocationValidator
- Inherits:
-
ActiveModel::Validator
- Object
- ActiveModel::Validator
- ReservedStockLocationValidator
- Defined in:
- app/models/spree/reserved_stock_item.rb
Overview
Validates that the StockLocation is specifically for reserved stock
Instance Method Summary collapse
Instance Method Details
#validate(record) ⇒ Object
3 4 5 6 7 |
# File 'app/models/spree/reserved_stock_item.rb', line 3 def validate(record) return unless record.stock_location # Missing stock location should be caught by other validator return if record.stock_location.reserved_items? record.errors[:stock_location] << "StockLocation for ReservedStockItems must have reserved_items? == true" end |