mongoid_countercache 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +6 -0
- data/README.md +1 -1
- data/lib/mongoid_countercache/counter_cache.rb +1 -2
- data/lib/mongoid_countercache/version.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c8a7b5a7c0d9f85ad111885359ae1e01a7a8bc37
|
4
|
+
data.tar.gz: 0f6c178d6003b8249d14d02609e0356b78745148
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 195e301a05b52502a51f521349b47db28ed7fcf47946d00ae706ece7da748619cca0dcefaae71ef1b4b03f1113a0acf81700b83ee33c1f5737facec4f3b88e26
|
7
|
+
data.tar.gz: b0de7ee0a326245acabd0c46ef0a7299f565df80f0f51d19d4c7d769d534436bd26474987b54b8c115fd5a6225f474d9eb49776990554656e49b61a9d3884d81
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# MongoidCounterCache
|
1
|
+
# MongoidCounterCache [![Build Status](https://travis-ci.org/Intrepidd/mongoid_countercache.png?branch=master)](https://travis-ci.org/Intrepidd/mongoid_countercache)
|
2
2
|
|
3
3
|
This gem is used to maintain a cached counter of an object's children, this avoids N + 1 queries issues when doing a ``count`` in a loop.
|
4
4
|
|
@@ -40,8 +40,7 @@ module Mongoid
|
|
40
40
|
|
41
41
|
def update_parent_counter(parent, field, inc, proc = nil)
|
42
42
|
return unless parent && parent[field]
|
43
|
-
parent
|
44
|
-
parent.save
|
43
|
+
parent.inc(field, inc) if proc.nil? || proc.bind(self).call
|
45
44
|
end
|
46
45
|
|
47
46
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongoid_countercache
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adrien Siami
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-11-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mongoid
|
@@ -95,6 +95,7 @@ extensions: []
|
|
95
95
|
extra_rdoc_files: []
|
96
96
|
files:
|
97
97
|
- .gitignore
|
98
|
+
- .travis.yml
|
98
99
|
- Gemfile
|
99
100
|
- LICENSE.txt
|
100
101
|
- README.md
|
@@ -128,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
128
129
|
version: '0'
|
129
130
|
requirements: []
|
130
131
|
rubyforge_project:
|
131
|
-
rubygems_version: 2.0.
|
132
|
+
rubygems_version: 2.0.3
|
132
133
|
signing_key:
|
133
134
|
specification_version: 4
|
134
135
|
summary: A simple counter cache implemented for mongoid, with neat additions such
|
@@ -139,3 +140,4 @@ test_files:
|
|
139
140
|
- spec/models/like.rb
|
140
141
|
- spec/models/post.rb
|
141
142
|
- spec/spec_helper.rb
|
143
|
+
has_rdoc:
|