Module: ActsAsParanoid::PreloaderAssociation

Defined in:
lib/acts_as_paranoid/preloader_association.rb

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/acts_as_paranoid/preloader_association.rb', line 3

def self.included(base)
  base.class_eval do
    def build_scope_with_deleted
      scope = build_scope_without_deleted
      scope = scope.with_deleted if reflection.options[:with_deleted] && klass.respond_to?(:with_deleted)
      scope
    end

    alias_method :build_scope_without_deleted, :build_scope
    alias_method :build_scope, :build_scope_with_deleted
  end
end