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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: adde693fbc8a3158f577294d8c824bd4635b9a2e
4
- data.tar.gz: 1841858ea2173cd8582d1f90a01c72e2c50afa59
3
+ metadata.gz: 257485aedd64efe7fa6d054b77d54170f88df34a
4
+ data.tar.gz: fd59ea55659f4c66717f7386945bb93268a2c5ad
5
5
  SHA512:
6
- metadata.gz: e60214e311c99e3d9ee493fb605293388eab2880211dcb7eea0ebded7606a5b1a622664de9a461e4a9c3d57fc9089816cb713af7c371066af94be4945acb1b96
7
- data.tar.gz: b5b0ef3c373f7017e69e781898b690de491721fd5847024a119c3bd6f73fb1bed02dc344ff1630730f6c67ecfbc0c4a68b21f3ab4c22c647496a09b2e3c9f090
6
+ metadata.gz: 1056dad890bac7862cc6f3d9a729412e85efbbe00d31798cc2f0f9b504c6b163e23b86df16c803703ba4f8e17e52d5a66e27b131bf4a27ede191192d0b76666b
7
+ data.tar.gz: 84cd87e9e0a0c3044087f5273139937ab1aec2650df93fbcf39e4fd1aa3d3f6c41541073fcf79407389951f236c3c75ad3e25facbe158fe886f35d698ff1e8cf
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 1.1.1 (January 13, 2017)
2
+
3
+ Bugfixes:
4
+ - Don't blow up if the `column_names` hash contains a `nil` column name
5
+
1
6
  ## 1.1.0 (December 23, 2016)
2
7
 
3
8
  Improvements:
data/Gemfile CHANGED
@@ -12,7 +12,7 @@ gem "activesupport", ">= 3.0.0"
12
12
  group :development, :test do
13
13
  gem "rake"
14
14
  gem "rails", '>= 3.1.0'
15
- gem "rspec", "~> 2.10.0"
15
+ gem "rspec", "~> 3.0"
16
16
  gem "awesome_print"
17
17
  end
18
18
 
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.1.3)
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 (2.10.0)
130
- rspec-core (~> 2.10.0)
131
- rspec-expectations (~> 2.10.0)
132
- rspec-mocks (~> 2.10.0)
133
- rspec-core (2.10.1)
134
- rspec-expectations (2.10.0)
135
- diff-lcs (~> 1.1.3)
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 (2.10.1)
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 (~> 2.10.0)
170
+ rspec (~> 3.0)
166
171
  rspec-extra-formatters
167
172
  sqlite3
168
173
 
169
174
  BUNDLED WITH
170
- 1.13.6
175
+ 1.13.7
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.0
1
+ 1.1.1
@@ -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.0 ruby lib
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.0"
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 = "2016-12-23"
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>, ["~> 2.10.0"])
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>, ["~> 2.10.0"])
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>, ["~> 2.10.0"])
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