Module: Immortal

Defined in:
lib/immortal.rb,
lib/immortal/version.rb,
lib/immortal/belongs_to.rb,
lib/immortal/belongs_to_builder.rb,
lib/immortal/singular_association.rb

Overview

Include Immortal module to activate soft delete on your model.

Defined Under Namespace

Modules: BelongsTo, ClassMethods, InstanceMethods, SingularAssociation Classes: BelongsToBuilder

Constant Summary collapse

COLUMN_NAME =
'deleted'.freeze
VERSION =
'3.1.0'.freeze

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/immortal.rb', line 7

def self.included(base)
  base.send :extend, ClassMethods
  base.send :include, InstanceMethods
  base.send :include, BelongsTo

  base.class_eval do
    class << self
      alias_method :mortal_delete_all, :delete_all
      alias_method :delete_all, :immortal_delete_all
    end
  end
end