counter_cache-rails 0.4.0 → 0.4.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: 4e366d2e9ba9c2ea381ea543695f11ff9aac9651
4
- data.tar.gz: 30a079055c0aea510cf06d2b62a7862fc67ee5d9
3
+ metadata.gz: 32d0efcf3589cb3d2f0f2a5fd63b878bd8146501
4
+ data.tar.gz: e609bd73d046a451134e94d9801ed3376158924c
5
5
  SHA512:
6
- metadata.gz: ac4740a77360d9976cff2745658687a7e0ea80b975e281405b310b24453dbcdbea6ff637c787f2e3f4bfff7a38b95c13c23399ff3720d31727e765875ae68684
7
- data.tar.gz: 14ada42e851b55324d5cce8c908884c6245b40470c51e81d04fe02da0a3f75afdad6e04b22dce1b5c40317b2bbd6c92589681ce0cec862dad0e4d2e6cb3c7820
6
+ metadata.gz: 6243a745cd31578e3e925d36d26de25e402a531a5dd1a4a94e76c9d9dd397858cc781c46e964b6ad2d11cb054e776b69f03ac8153da641ab43cb7926808b939e
7
+ data.tar.gz: 28af17d6cf549d993ef492957d34aed05f07337950c901dcf673ed25f5196d56d9a38b43b677cffe3884e60db2b88cd2bd5246353044c942d5339214871e514c
@@ -47,7 +47,8 @@ module CounterCacheRails
47
47
  define_method "_#{tableized_child_model}_count_incr" do
48
48
  run_callbacks callback_names[:update] do
49
49
  run_callbacks callback_names[:increment] do
50
- Rails.cache.increment(_counter_cache_key(class_name, primary_key, tableized_child_model))
50
+ key = _counter_cache_key(class_name, primary_key, tableized_child_model)
51
+ Rails.cache.exist?(key) ? Rails.cache.increment(key) : send("#{tableized_child_model}_count")
51
52
  end
52
53
  end
53
54
  end
@@ -55,7 +56,8 @@ module CounterCacheRails
55
56
  define_method "_#{tableized_child_model}_count_decr" do
56
57
  run_callbacks callback_names[:update] do
57
58
  run_callbacks callback_names[:decrement] do
58
- Rails.cache.decrement(_counter_cache_key(class_name, primary_key, tableized_child_model))
59
+ key = _counter_cache_key(class_name, primary_key, tableized_child_model)
60
+ Rails.cache.exist?(key) ? Rails.cache.decrement(key) : send("#{tableized_child_model}_count")
59
61
  end
60
62
  end
61
63
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CounterCacheRails
4
- VERSION = '0.4.0'
4
+ VERSION = '0.4.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: counter_cache-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shota Iguchi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-24 00:00:00.000000000 Z
11
+ date: 2018-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails