yoomee-acts_as_mongo_taggable 0.2.4 → 0.2.5
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/lib/app/models/tag.rb +9 -1
- metadata +3 -3
data/lib/app/models/tag.rb
CHANGED
|
@@ -3,6 +3,14 @@ class Tag
|
|
|
3
3
|
key :word, String, :required => true, :index => true
|
|
4
4
|
key :taggings_count, Integer, :index => true
|
|
5
5
|
|
|
6
|
+
begin
|
|
7
|
+
MongoSphinx
|
|
8
|
+
has_mongo_sphinx = true
|
|
9
|
+
rescue NameError => e
|
|
10
|
+
has_mongo_sphinx = false
|
|
11
|
+
end
|
|
12
|
+
fulltext_index :word, :delta => true if has_mongo_sphinx
|
|
13
|
+
|
|
6
14
|
many :taggings do
|
|
7
15
|
def << (tagging)
|
|
8
16
|
super << tagging
|
|
@@ -19,7 +27,7 @@ class Tag
|
|
|
19
27
|
ensure_index 'taggings.taggable_type'
|
|
20
28
|
ensure_index 'taggings.taggable_id'
|
|
21
29
|
|
|
22
|
-
before_save :set_tagging_counts
|
|
30
|
+
before_save :set_tagging_counts
|
|
23
31
|
|
|
24
32
|
def self.register_taggable_type(type)
|
|
25
33
|
key taggings_count_key_for(type), Integer, :index => true
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: yoomee-acts_as_mongo_taggable
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 29
|
|
5
5
|
prerelease: false
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
8
|
- 2
|
|
9
|
-
-
|
|
10
|
-
version: 0.2.
|
|
9
|
+
- 5
|
|
10
|
+
version: 0.2.5
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- Matt Atkins, Matt E. Patterson
|