counter_culture 1.9.0 → 1.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +8 -6
- data/CHANGELOG.md +5 -0
- data/Gemfile +3 -3
- data/VERSION +1 -1
- data/counter_culture.gemspec +6 -6
- data/lib/counter_culture/extensions.rb +4 -1
- data/lib/generators/templates/counter_culture_migration.rb.erb +1 -1
- data/test_rails_versions.sh +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dbd19171ad987974f7c8b1a22586f79d213480fb
|
4
|
+
data.tar.gz: ec110a9a8e59b1edd33b1208d588bf2640229dec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ecc374dd09b2af3f7ae325acb30f567b87258aeebce9fbd236266f1ed64b13965dd4c50b11db7a45d634c107d314438c578819975aa10e37c1abc1445ce474ff
|
7
|
+
data.tar.gz: 6c837a717f549c2b4767c769c9d79087ab0b6c8bde80ed411acbf5fbd75bc144e4fceb0ded912624a2a68c8f5b830a24eac6ecc34416dd10e40304da70630274
|
data/.travis.yml
CHANGED
@@ -3,12 +3,14 @@ rvm:
|
|
3
3
|
- "2.2.5"
|
4
4
|
- "2.3.1"
|
5
5
|
env:
|
6
|
-
-
|
7
|
-
-
|
8
|
-
-
|
9
|
-
-
|
10
|
-
-
|
11
|
-
-
|
6
|
+
- 'RAILS_VERSION="~> 3.2.0"'
|
7
|
+
- 'RAILS_VERSION="~> 4.0.0"'
|
8
|
+
- 'RAILS_VERSION="~> 4.1.0"'
|
9
|
+
- 'RAILS_VERSION="~> 4.2.0"'
|
10
|
+
- 'RAILS_VERSION="~> 5.0.0"'
|
11
|
+
- 'RAILS_VERSION="= 5.1.4"'
|
12
|
+
- 'RAILS_VERSION="= 5.1.5"'
|
13
|
+
- 'RAILS_VERSION="~> 5.1.5"'
|
12
14
|
install:
|
13
15
|
- bundle update
|
14
16
|
script: TRAVIS=true bundle exec rake spec
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
@@ -14,13 +14,13 @@ group :development, :test do
|
|
14
14
|
|
15
15
|
rails = case ENV["RAILS_VERSION"]
|
16
16
|
when "master"
|
17
|
-
{github: "rails/rails"}
|
17
|
+
{ github: "rails/rails" }
|
18
18
|
when nil, ""
|
19
19
|
">= 3.1.0"
|
20
20
|
else
|
21
|
-
|
21
|
+
ENV["RAILS_VERSION"]
|
22
22
|
end
|
23
|
-
gem "rails",
|
23
|
+
gem "rails", ENV['RAILS_VERSION']
|
24
24
|
|
25
25
|
gem "rspec", "~> 3.0"
|
26
26
|
gem "awesome_print"
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.9.
|
1
|
+
1.9.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.9.
|
5
|
+
# stub: counter_culture 1.9.1 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "counter_culture"
|
9
|
-
s.version = "1.9.
|
9
|
+
s.version = "1.9.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 = "2018-03-01"
|
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 = [
|
@@ -131,7 +131,7 @@ Gem::Specification.new do |s|
|
|
131
131
|
s.add_runtime_dependency(%q<activerecord>, [">= 3.0.0"])
|
132
132
|
s.add_runtime_dependency(%q<activesupport>, [">= 3.0.0"])
|
133
133
|
s.add_development_dependency(%q<rake>, [">= 0"])
|
134
|
-
s.add_development_dependency(%q<rails>, ["
|
134
|
+
s.add_development_dependency(%q<rails>, ["= 5.1.5"])
|
135
135
|
s.add_development_dependency(%q<rspec>, ["~> 3.0"])
|
136
136
|
s.add_development_dependency(%q<awesome_print>, [">= 0"])
|
137
137
|
s.add_development_dependency(%q<timecop>, [">= 0"])
|
@@ -145,7 +145,7 @@ Gem::Specification.new do |s|
|
|
145
145
|
s.add_dependency(%q<activerecord>, [">= 3.0.0"])
|
146
146
|
s.add_dependency(%q<activesupport>, [">= 3.0.0"])
|
147
147
|
s.add_dependency(%q<rake>, [">= 0"])
|
148
|
-
s.add_dependency(%q<rails>, ["
|
148
|
+
s.add_dependency(%q<rails>, ["= 5.1.5"])
|
149
149
|
s.add_dependency(%q<rspec>, ["~> 3.0"])
|
150
150
|
s.add_dependency(%q<awesome_print>, [">= 0"])
|
151
151
|
s.add_dependency(%q<timecop>, [">= 0"])
|
@@ -160,7 +160,7 @@ Gem::Specification.new do |s|
|
|
160
160
|
s.add_dependency(%q<activerecord>, [">= 3.0.0"])
|
161
161
|
s.add_dependency(%q<activesupport>, [">= 3.0.0"])
|
162
162
|
s.add_dependency(%q<rake>, [">= 0"])
|
163
|
-
s.add_dependency(%q<rails>, ["
|
163
|
+
s.add_dependency(%q<rails>, ["= 5.1.5"])
|
164
164
|
s.add_dependency(%q<rspec>, ["~> 3.0"])
|
165
165
|
s.add_dependency(%q<awesome_print>, [">= 0"])
|
166
166
|
s.add_dependency(%q<timecop>, [">= 0"])
|
@@ -79,7 +79,6 @@ module CounterCulture
|
|
79
79
|
if @_counter_culture_active
|
80
80
|
# don't do anything; we are already active for this transaction
|
81
81
|
else
|
82
|
-
@_counter_culture_active = true
|
83
82
|
block.call
|
84
83
|
execute_after_commit { @_counter_culture_active = false}
|
85
84
|
end
|
@@ -88,6 +87,7 @@ module CounterCulture
|
|
88
87
|
# called by after_create callback
|
89
88
|
def _update_counts_after_create
|
90
89
|
_wrap_in_counter_culture_active do
|
90
|
+
@_counter_culture_active = true
|
91
91
|
self.class.after_commit_counter_cache.each do |counter|
|
92
92
|
# increment counter cache
|
93
93
|
counter.change_counter_cache(self, :increment => true)
|
@@ -98,6 +98,7 @@ module CounterCulture
|
|
98
98
|
# called by after_destroy callback
|
99
99
|
def _update_counts_after_destroy
|
100
100
|
_wrap_in_counter_culture_active do
|
101
|
+
@_counter_culture_active = true
|
101
102
|
self.class.after_commit_counter_cache.each do |counter|
|
102
103
|
# decrement counter cache
|
103
104
|
counter.change_counter_cache(self, :increment => false)
|
@@ -118,6 +119,8 @@ module CounterCulture
|
|
118
119
|
(counter.delta_column && counter.attribute_changed?(self, counter.delta_column)) ||
|
119
120
|
counter_cache_name != counter_cache_name_was
|
120
121
|
|
122
|
+
@_counter_culture_active = true
|
123
|
+
|
121
124
|
# increment the counter cache of the new value
|
122
125
|
counter.change_counter_cache(self, :increment => true, :counter_column => counter_cache_name)
|
123
126
|
# decrement the counter cache of the old value
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class <%= migration_class_name %> < ActiveRecord::Migration<%= migration_version %>
|
2
2
|
def self.up<% counter_cache_columns.each do |column| %>
|
3
|
-
add_column :<%= table_name %>, :<%= column %>, :integer, null: false, default:
|
3
|
+
add_column :<%= table_name %>, :<%= column %>, :integer, null: false, default: 0
|
4
4
|
<% end %> end
|
5
5
|
|
6
6
|
def self.down<% counter_cache_columns.each do |column| %>
|
data/test_rails_versions.sh
CHANGED
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: 1.9.
|
4
|
+
version: 1.9.1
|
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:
|
11
|
+
date: 2018-03-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: after_commit_action
|
@@ -70,16 +70,16 @@ dependencies:
|
|
70
70
|
name: rails
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - '='
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: 5.1.5
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - '='
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: 5.1.5
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rspec
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|