Sha256: c92eb5edba905b4379d80e76787c9ca7d91cad5fb5d0a704469f29838fe86b2c

Contents?: true

Size: 446 Bytes

Versions: 3

Compression:

Stored size: 446 Bytes

Contents

module GuardAgainstPhysicalDelete
  module Relation
    def self.included(obj)
      obj.class_eval do
        def delete_all_with_check_permit(conditions = nil)
          unless @klass.delete_permitted?
            raise GuardAgainstPhysicalDelete::PhysicalDeleteError, @klass.name
          end
          delete_all_without_check_permit(conditions)
        end

        alias_method_chain :delete_all, :check_permit
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
guard_against_physical_delete-1.0.2 lib/guard_against_physical_delete/relation.rb
guard_against_physical_delete-1.0.1 lib/guard_against_physical_delete/relation.rb
guard_against_physical_delete-1.0.0 lib/guard_against_physical_delete/relation.rb