mongoid_counter_cache 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.markdown +7 -2
- data/lib/mongoid_counter_cache/version.rb +1 -1
- data/lib/mongoid_counter_cache.rb +1 -1
- metadata +3 -3
data/README.markdown
CHANGED
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
##Support:
|
|
2
2
|
|
|
3
|
-
**Rails3.0+/Mongoid2.0.2
|
|
3
|
+
**Rails3.0+/Mongoid2.0.2+/Ruby1.8/1.9**
|
|
4
4
|
|
|
5
5
|
##Usage:
|
|
6
6
|
|
|
7
7
|
class Forum
|
|
8
8
|
references_many :topics
|
|
9
9
|
references_many :posts
|
|
10
|
+
|
|
11
|
+
field :topics_count, :type => Integer, :default => 0
|
|
12
|
+
field :posts_count, :type => Integer, :default => 0
|
|
10
13
|
end
|
|
11
14
|
|
|
12
15
|
class Topic
|
|
13
16
|
referenced_in :forum
|
|
14
17
|
include Mongoid::CounterCache
|
|
15
|
-
counter_cache name
|
|
18
|
+
counter_cache :name => :forum, :inverse_of => posts
|
|
16
19
|
end
|
|
17
20
|
|
|
21
|
+
|
|
22
|
+
|
|
@@ -6,7 +6,7 @@ require "mongoid_counter_cache/version"
|
|
|
6
6
|
# ruby
|
|
7
7
|
#
|
|
8
8
|
# Created by Zhang Alex on 2011-06-17.
|
|
9
|
-
# Copyright 2011
|
|
9
|
+
# Copyright 2011 __blackanger.z@gmail.com__. All rights reserved.
|
|
10
10
|
#
|
|
11
11
|
# ===================================
|
|
12
12
|
# class Forum
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mongoid_counter_cache
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 27
|
|
5
5
|
prerelease:
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
8
|
- 0
|
|
9
|
-
-
|
|
10
|
-
version: 0.0.
|
|
9
|
+
- 2
|
|
10
|
+
version: 0.0.2
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- AlexZhang
|