acts_as_paranoid 0.6.2 → 0.7.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,16 +0,0 @@
1
- module ActsAsParanoid
2
- module PreloaderAssociation
3
- def self.included(base)
4
- base.class_eval do
5
- def build_scope_with_deleted
6
- scope = build_scope_without_deleted
7
- scope = scope.with_deleted if reflection.options[:with_deleted] && klass.respond_to?(:with_deleted)
8
- scope
9
- end
10
-
11
- alias_method :build_scope_without_deleted, :build_scope
12
- alias_method :build_scope, :build_scope_with_deleted
13
- end
14
- end
15
- end
16
- end
@@ -1,27 +0,0 @@
1
- require 'test_helper'
2
-
3
- class PreloaderAssociationTest < ParanoidBaseTest
4
- def test_includes_with_deleted
5
- paranoid_time = ParanoidTime.first
6
- paranoid_has_many_dependant = paranoid_time.paranoid_has_many_dependants.create(:name => 'dependant!')
7
-
8
- paranoid_time.destroy
9
-
10
- ParanoidHasManyDependant.with_deleted.includes(:paranoid_time_with_deleted).each do |hasmany|
11
- assert_not_nil hasmany.paranoid_time_with_deleted
12
- end
13
- end
14
-
15
- def test_includes_with_deleted_with_polymorphic_parent
16
- not_paranoid_parent = NotParanoidHasManyAsParent.create(name: 'not paranoid parent')
17
- paranoid_parent = ParanoidHasManyAsParent.create(name: 'paranoid parent')
18
- ParanoidBelongsToPolymorphic.create(:name => 'belongs_to', :parent => not_paranoid_parent)
19
- ParanoidBelongsToPolymorphic.create(:name => 'belongs_to', :parent => paranoid_parent)
20
-
21
- paranoid_parent.destroy
22
-
23
- ParanoidBelongsToPolymorphic.with_deleted.includes(:parent).each do |hasmany|
24
- assert_not_nil hasmany.parent
25
- end
26
- end
27
- end