custom_counter_cache 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/custom_counter_cache/model.rb +2 -2
- data/lib/custom_counter_cache/version.rb +1 -1
- data/test/counter_test.rb +2 -1
- data/test/test_helper.rb +1 -1
- metadata +12 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 66fc160dfabec304e7ce5111f1c1a83e884ef36a
|
4
|
+
data.tar.gz: 55ad131d50a4c2e22d4badc976f95f98a712faea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 02355008f524af7086e011d7bf16a0a00d47cef869af4d363aaee420535c82e9e2ede4c3ccd079b96ee8b990feb5ab94f02dc220717f81ad3676954054bc3c06
|
7
|
+
data.tar.gz: 20f6036a75d16e6c20ad0333de36e4dbbc8cfc4198689a6d5761827ab33e3697022daf71da156fa162a64b6817f8c697db6d0e7eef4c8fe25f0af7eba5555d06
|
@@ -17,11 +17,11 @@ module CustomCounterCache::Model
|
|
17
17
|
if counters.loaded? && counter = counters.detect{|c| c.key == cache_column.to_s }
|
18
18
|
counter.value
|
19
19
|
else
|
20
|
-
counters.
|
20
|
+
counters.find_by_key(cache_column.to_s).try(:value).to_i
|
21
21
|
end
|
22
22
|
end
|
23
23
|
define_method "#{cache_column}=" do |count|
|
24
|
-
if ( counter = counters.
|
24
|
+
if ( counter = counters.find_by_key(cache_column.to_s) )
|
25
25
|
counter.update_attribute :value, count.to_i
|
26
26
|
else
|
27
27
|
counters.create :key => cache_column.to_s, :value => count.to_i
|
data/test/counter_test.rb
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__), 'test_helper')
|
2
2
|
|
3
|
-
class CounterTest <
|
3
|
+
class CounterTest < MiniTest::Unit::TestCase
|
4
4
|
|
5
5
|
def setup
|
6
6
|
@user = User.create
|
7
7
|
@box = Box.create
|
8
|
+
Counter.destroy_all
|
8
9
|
end
|
9
10
|
|
10
11
|
def test_default_counter_value
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,41 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: custom_counter_cache
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cedric Howe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-02-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: sqlite3
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
description: ''
|
@@ -44,9 +44,9 @@ executables: []
|
|
44
44
|
extensions: []
|
45
45
|
extra_rdoc_files: []
|
46
46
|
files:
|
47
|
+
- lib/custom_counter_cache.rb
|
47
48
|
- lib/custom_counter_cache/model.rb
|
48
49
|
- lib/custom_counter_cache/version.rb
|
49
|
-
- lib/custom_counter_cache.rb
|
50
50
|
- test/counter_test.rb
|
51
51
|
- test/test_helper.rb
|
52
52
|
homepage: http://github.com/cedric/custom_counter_cache/
|
@@ -59,17 +59,17 @@ require_paths:
|
|
59
59
|
- lib
|
60
60
|
required_ruby_version: !ruby/object:Gem::Requirement
|
61
61
|
requirements:
|
62
|
-
- -
|
62
|
+
- - ">="
|
63
63
|
- !ruby/object:Gem::Version
|
64
64
|
version: '0'
|
65
65
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
|
-
- -
|
67
|
+
- - ">="
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: 1.3.6
|
70
70
|
requirements: []
|
71
71
|
rubyforge_project: custom_counter_cache
|
72
|
-
rubygems_version: 2.
|
72
|
+
rubygems_version: 2.4.5
|
73
73
|
signing_key:
|
74
74
|
specification_version: 4
|
75
75
|
summary: Custom counter_cache functionality that supports conditions and multiple
|