counter_culture 2.1.1 → 2.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/VERSION +1 -1
- data/counter_culture.gemspec +3 -3
- data/lib/counter_culture/extensions.rb +6 -0
- data/spec/counter_culture_spec.rb +29 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c7959919b657fa78f0411dfbab1d943126a56299845d675153cbc22b14dd379f
|
4
|
+
data.tar.gz: 478dd534275fa4b591c27dfee2430cd3ca0b51230ef1761ac65b29d9e457cb71
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 82971d075ad62b51f70648e7fb00dc8b3be73bbe5243d7aea5bf341f0f4d9a33c2b34ec6e205c196069f6eb32d3e1dea85f9f7197278c9f769d426d095aa85dc
|
7
|
+
data.tar.gz: fec145c1cf38738c96c0a6e78bb67ca596813acb97fa16e7ee1e5265db3ddc567e6484ad812f35917f2d310e9a9f4a5bece98fd4f5fc4018e6e28d31a970ded7
|
data/CHANGELOG.md
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.1.
|
1
|
+
2.1.2
|
data/counter_culture.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: counter_culture 2.1.
|
5
|
+
# stub: counter_culture 2.1.2 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "counter_culture".freeze
|
9
|
-
s.version = "2.1.
|
9
|
+
s.version = "2.1.2"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib".freeze]
|
13
13
|
s.authors = ["Magnus von Koeller".freeze]
|
14
|
-
s.date = "2018-
|
14
|
+
s.date = "2018-12-07"
|
15
15
|
s.description = "counter_culture provides turbo-charged counter caches that are kept up-to-date not just on create and destroy, that support multiple levels of indirection through relationships, allow dynamic column names and that avoid deadlocks by updating in the after_commit callback.".freeze
|
16
16
|
s.email = "magnus@vonkoeller.de".freeze
|
17
17
|
s.extra_rdoc_files = [
|
@@ -30,6 +30,12 @@ module CounterCulture
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
+
if respond_to?(:before_real_destroy) &&
|
34
|
+
new.respond_to?(:paranoia_destroyed?)
|
35
|
+
before_real_destroy :_update_counts_after_destroy,
|
36
|
+
if: -> (model) { !model.paranoia_destroyed? }
|
37
|
+
end
|
38
|
+
|
33
39
|
after_update :_update_counts_after_update
|
34
40
|
|
35
41
|
if respond_to?(:before_restore)
|
@@ -1869,6 +1869,35 @@ describe "CounterCulture" do
|
|
1869
1869
|
sd.restore
|
1870
1870
|
expect(company.reload.soft_delete_paranoia_count).to eq(1)
|
1871
1871
|
end
|
1872
|
+
|
1873
|
+
describe "when calling paranoia really destroy" do
|
1874
|
+
it "does not run destroy callback for paranoia destroyed records" do
|
1875
|
+
skip("Unsupported in this version of Rails") if Rails.version < "4.2.0"
|
1876
|
+
|
1877
|
+
company = Company.create!
|
1878
|
+
sd = SoftDeleteParanoia.create!(company_id: company.id)
|
1879
|
+
|
1880
|
+
expect(company.reload.soft_delete_paranoia_count).to eq(1)
|
1881
|
+
|
1882
|
+
sd.destroy
|
1883
|
+
expect(company.reload.soft_delete_paranoia_count).to eq(0)
|
1884
|
+
|
1885
|
+
sd.really_destroy!
|
1886
|
+
expect(company.reload.soft_delete_paranoia_count).to eq(0)
|
1887
|
+
end
|
1888
|
+
|
1889
|
+
it "runs really destroy callback for paranoia undestroyed records" do
|
1890
|
+
skip("Unsupported in this version of Rails") if Rails.version < "4.2.0"
|
1891
|
+
company = Company.create!
|
1892
|
+
expect(company.soft_delete_paranoia_count).to eq(0)
|
1893
|
+
sd = SoftDeleteParanoia.create!(company_id: company.id)
|
1894
|
+
expect(company.reload.soft_delete_paranoia_count).to eq(1)
|
1895
|
+
|
1896
|
+
sd.really_destroy!
|
1897
|
+
expect{ sd.reload }.to raise_error(ActiveRecord::RecordNotFound)
|
1898
|
+
expect(company.reload.soft_delete_paranoia_count).to eq(0)
|
1899
|
+
end
|
1900
|
+
end
|
1872
1901
|
end
|
1873
1902
|
|
1874
1903
|
describe "with polymorphic_associations" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: counter_culture
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Magnus von Koeller
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-12-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: after_commit_action
|