Class: ActiveRecord::Validations::AssociationNotSoftDestroyedValidator
- Inherits:
-
ActiveModel::EachValidator
- Object
- ActiveModel::EachValidator
- ActiveRecord::Validations::AssociationNotSoftDestroyedValidator
- Defined in:
- lib/paranoia.rb
Instance Method Summary collapse
Instance Method Details
#validate_each(record, attribute, value) ⇒ Object
333 334 335 336 337 338 |
# File 'lib/paranoia.rb', line 333 def validate_each(record, attribute, value) # if association is soft destroyed, add an error if value.present? && value.paranoia_destroyed? record.errors.add(attribute, 'has been soft-deleted') end end |