Class: Ecom::Core::MaterialIdentity
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Ecom::Core::MaterialIdentity
- Defined in:
- app/models/ecom/core/material_identity.rb
Instance Method Summary collapse
Instance Method Details
#material_category_hierarchy_validator ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'app/models/ecom/core/material_identity.rb', line 10 def material_category_hierarchy_validator return if material_type_id.nil? || material_sub_type_id.nil? material_sub_type = MaterialSubType.find_by(id: material_sub_type_id) return unless material_sub_type.material_type_id != material_type_id errors.add(:material_type, 'The given material_sub_type does not belong to the given material_type') end |