counter_culture 1.1.0 → 1.1.1
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/Gemfile +1 -1
- data/Gemfile.lock +16 -11
- data/VERSION +1 -1
- data/counter_culture.gemspec +6 -6
- data/lib/counter_culture/reconciler.rb +6 -0
- data/spec/counter_culture_spec.rb +410 -388
- data/spec/models/review.rb +1 -1
- data/spec/spec_helper.rb +3 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 257485aedd64efe7fa6d054b77d54170f88df34a
|
4
|
+
data.tar.gz: fd59ea55659f4c66717f7386945bb93268a2c5ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1056dad890bac7862cc6f3d9a729412e85efbbe00d31798cc2f0f9b504c6b163e23b86df16c803703ba4f8e17e52d5a66e27b131bf4a27ede191192d0b76666b
|
7
|
+
data.tar.gz: 84cd87e9e0a0c3044087f5273139937ab1aec2650df93fbcf39e4fd1aa3d3f6c41541073fcf79407389951f236c3c75ad3e25facbe158fe886f35d698ff1e8cf
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -47,7 +47,7 @@ GEM
|
|
47
47
|
database_cleaner (1.5.1)
|
48
48
|
descendants_tracker (0.0.4)
|
49
49
|
thread_safe (~> 0.3, >= 0.3.1)
|
50
|
-
diff-lcs (1.
|
50
|
+
diff-lcs (1.2.5)
|
51
51
|
erubis (2.7.0)
|
52
52
|
faraday (0.9.2)
|
53
53
|
multipart-post (>= 1.2, < 3)
|
@@ -126,15 +126,20 @@ GEM
|
|
126
126
|
rake (11.3.0)
|
127
127
|
rdoc (3.12.2)
|
128
128
|
json (~> 1.4)
|
129
|
-
rspec (
|
130
|
-
rspec-core (~>
|
131
|
-
rspec-expectations (~>
|
132
|
-
rspec-mocks (~>
|
133
|
-
rspec-core (
|
134
|
-
|
135
|
-
|
129
|
+
rspec (3.5.0)
|
130
|
+
rspec-core (~> 3.5.0)
|
131
|
+
rspec-expectations (~> 3.5.0)
|
132
|
+
rspec-mocks (~> 3.5.0)
|
133
|
+
rspec-core (3.5.4)
|
134
|
+
rspec-support (~> 3.5.0)
|
135
|
+
rspec-expectations (3.5.0)
|
136
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
137
|
+
rspec-support (~> 3.5.0)
|
136
138
|
rspec-extra-formatters (1.0.0)
|
137
|
-
rspec-mocks (
|
139
|
+
rspec-mocks (3.5.0)
|
140
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
141
|
+
rspec-support (~> 3.5.0)
|
142
|
+
rspec-support (3.5.0)
|
138
143
|
semver (1.0.1)
|
139
144
|
sprockets (3.4.0)
|
140
145
|
rack (> 1, < 3)
|
@@ -162,9 +167,9 @@ DEPENDENCIES
|
|
162
167
|
rails (>= 3.1.0)
|
163
168
|
rake
|
164
169
|
rdoc (~> 3.12)
|
165
|
-
rspec (~>
|
170
|
+
rspec (~> 3.0)
|
166
171
|
rspec-extra-formatters
|
167
172
|
sqlite3
|
168
173
|
|
169
174
|
BUNDLED WITH
|
170
|
-
1.13.
|
175
|
+
1.13.7
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1.
|
1
|
+
1.1.1
|
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 1.1.
|
5
|
+
# stub: counter_culture 1.1.1 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "counter_culture"
|
9
|
-
s.version = "1.1.
|
9
|
+
s.version = "1.1.1"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Magnus von Koeller"]
|
14
|
-
s.date = "
|
14
|
+
s.date = "2017-01-13"
|
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."
|
16
16
|
s.email = "magnus@vonkoeller.de"
|
17
17
|
s.extra_rdoc_files = [
|
@@ -128,7 +128,7 @@ Gem::Specification.new do |s|
|
|
128
128
|
s.add_runtime_dependency(%q<activesupport>, [">= 3.0.0"])
|
129
129
|
s.add_development_dependency(%q<rake>, [">= 0"])
|
130
130
|
s.add_development_dependency(%q<rails>, [">= 3.1.0"])
|
131
|
-
s.add_development_dependency(%q<rspec>, ["~>
|
131
|
+
s.add_development_dependency(%q<rspec>, ["~> 3.0"])
|
132
132
|
s.add_development_dependency(%q<awesome_print>, [">= 0"])
|
133
133
|
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
|
134
134
|
s.add_development_dependency(%q<bundler>, [">= 1.2.0"])
|
@@ -139,7 +139,7 @@ Gem::Specification.new do |s|
|
|
139
139
|
s.add_dependency(%q<activesupport>, [">= 3.0.0"])
|
140
140
|
s.add_dependency(%q<rake>, [">= 0"])
|
141
141
|
s.add_dependency(%q<rails>, [">= 3.1.0"])
|
142
|
-
s.add_dependency(%q<rspec>, ["~>
|
142
|
+
s.add_dependency(%q<rspec>, ["~> 3.0"])
|
143
143
|
s.add_dependency(%q<awesome_print>, [">= 0"])
|
144
144
|
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
145
145
|
s.add_dependency(%q<bundler>, [">= 1.2.0"])
|
@@ -151,7 +151,7 @@ Gem::Specification.new do |s|
|
|
151
151
|
s.add_dependency(%q<activesupport>, [">= 3.0.0"])
|
152
152
|
s.add_dependency(%q<rake>, [">= 0"])
|
153
153
|
s.add_dependency(%q<rails>, [">= 3.1.0"])
|
154
|
-
s.add_dependency(%q<rspec>, ["~>
|
154
|
+
s.add_dependency(%q<rspec>, ["~> 3.0"])
|
155
155
|
s.add_dependency(%q<awesome_print>, [">= 0"])
|
156
156
|
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
157
157
|
s.add_dependency(%q<bundler>, [">= 1.2.0"])
|
@@ -39,6 +39,12 @@ module CounterCulture
|
|
39
39
|
|
40
40
|
# iterate over all the possible counter cache column names
|
41
41
|
counter_column_names.each do |where, column_name|
|
42
|
+
# if the column name is nil, that means those records don't affect
|
43
|
+
# counts; we don't need to do anything in that case. but we allow
|
44
|
+
# specifying that condition regardless to make the syntax less
|
45
|
+
# confusing
|
46
|
+
next unless column_name
|
47
|
+
|
42
48
|
# select join column and count (from above) as well as cache column ('column_name') for later comparison
|
43
49
|
counts_query = scope.select("#{relation_class.table_name}.#{relation_class.primary_key}, #{relation_class.table_name}.#{relation_reflect(relation).association_primary_key}, #{count_select} AS count, #{relation_class.table_name}.#{column_name}")
|
44
50
|
|