Class: SupplierCategory
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- SupplierCategory
- Defined in:
- app/models/supplier_category.rb
Instance Method Summary collapse
-
#check_for_associated_suppliers ⇒ Object
protected
Deny deleting the category when there are associated suppliers.
Instance Method Details
#check_for_associated_suppliers ⇒ Object (protected)
Deny deleting the category when there are associated suppliers.
15 16 17 |
# File 'app/models/supplier_category.rb', line 15 def check_for_associated_suppliers raise I18n.t('activerecord.errors.has_many_left', collection: Supplier.model_name.human) if suppliers.undeleted.any? end |