Class: SupplierCategory

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/supplier_category.rb

Instance Method Summary collapse

Instance Method Details

#check_for_associated_suppliersObject (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