Module: WnmSupport::ActiveRecordExt::DestroyValidation

Extended by:
ActiveSupport::Concern
Defined in:
lib/wnm_support/active_record_ext/destroy_validation.rb

Instance Method Summary collapse

Instance Method Details

#can_destroy?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/wnm_support/active_record_ext/destroy_validation.rb', line 10

def can_destroy?
  false
end

#check_before_destroyObject



14
15
16
17
18
19
20
21
# File 'lib/wnm_support/active_record_ext/destroy_validation.rb', line 14

def check_before_destroy
  if can_destroy?
    true
  else
    errors.add(:base, "not allowed")
    false
  end
end