acts-as-taggable-on-mongoid 6.0.1.3 → 6.0.1.4
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af4d572cdcc8a7de95f1dcac892e964c49949c7f
|
4
|
+
data.tar.gz: 6decc0b45a8fc8dddd9fc0a4847a47687f7e41ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 734a781c9f3ea1bb20d0ef58a383e5a99e4395e730dd94afd8cce50fdadde7f1d73b697b6cc1d21bdb8e6c4d06ae2160f2a5e651d8781658b775acec7f7c2763
|
7
|
+
data.tar.gz: 1c1fa773bb6f119f8a218c10a12f1855fb83de9d55e7fa1b9fc3ec0d0ca02288c458d856ac795c44af2b8cd245a7d33544b6c474dfd3f080cabc29ea22c19af1
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
acts-as-taggable-on-mongoid (6.0.1.
|
4
|
+
acts-as-taggable-on-mongoid (6.0.1.4)
|
5
5
|
activesupport (~> 4.2)
|
6
6
|
mongoid (~> 5.2)
|
7
7
|
|
@@ -30,14 +30,14 @@ GEM
|
|
30
30
|
sexp_processor
|
31
31
|
codeclimate-engine-rb (0.4.1)
|
32
32
|
virtus (~> 1.0)
|
33
|
-
codecov (0.1.
|
33
|
+
codecov (0.1.14)
|
34
34
|
json
|
35
35
|
simplecov
|
36
36
|
url
|
37
37
|
coercible (1.0.0)
|
38
38
|
descendants_tracker (~> 0.0.1)
|
39
39
|
colorize (0.8.1)
|
40
|
-
concurrent-ruby (1.
|
40
|
+
concurrent-ruby (1.1.3)
|
41
41
|
cornucopia (0.1.55)
|
42
42
|
activesupport (< 5.0)
|
43
43
|
database_cleaner (1.7.0)
|
@@ -47,16 +47,17 @@ GEM
|
|
47
47
|
docile (1.3.1)
|
48
48
|
equalizer (0.0.11)
|
49
49
|
erubis (2.7.0)
|
50
|
-
faraday (0.15.
|
50
|
+
faraday (0.15.4)
|
51
51
|
multipart-post (>= 1.2, < 3)
|
52
52
|
fasterer (0.4.1)
|
53
53
|
colorize (~> 0.7)
|
54
54
|
ruby_parser (~> 3.11.0)
|
55
55
|
gem-release (2.0.1)
|
56
|
-
gitlab (4.
|
56
|
+
gitlab (4.7.0)
|
57
57
|
httparty (>= 0.14.0)
|
58
58
|
terminal-table (>= 1.5.1)
|
59
|
-
httparty (0.16.
|
59
|
+
httparty (0.16.3)
|
60
|
+
mime-types (~> 3.0)
|
60
61
|
multi_xml (>= 0.5.2)
|
61
62
|
i18n (0.9.5)
|
62
63
|
concurrent-ruby (~> 1.0)
|
@@ -64,6 +65,9 @@ GEM
|
|
64
65
|
jaro_winkler (1.5.1)
|
65
66
|
json (2.1.0)
|
66
67
|
kwalify (0.7.2)
|
68
|
+
mime-types (3.2.2)
|
69
|
+
mime-types-data (~> 3.2015)
|
70
|
+
mime-types-data (3.2018.0812)
|
67
71
|
minitest (5.11.3)
|
68
72
|
mongo (2.6.2)
|
69
73
|
bson (>= 4.3.0, < 5.0.0)
|
@@ -74,11 +78,11 @@ GEM
|
|
74
78
|
tzinfo (>= 0.3.37)
|
75
79
|
multi_xml (0.6.0)
|
76
80
|
multipart-post (2.0.0)
|
77
|
-
octokit (4.
|
81
|
+
octokit (4.13.0)
|
78
82
|
sawyer (~> 0.8.0, >= 0.5.3)
|
79
83
|
origin (2.3.1)
|
80
84
|
parallel (1.12.1)
|
81
|
-
parser (2.5.
|
85
|
+
parser (2.5.3.0)
|
82
86
|
ast (~> 2.4.0)
|
83
87
|
powerpack (0.1.2)
|
84
88
|
pronto (0.9.5)
|
@@ -106,7 +110,7 @@ GEM
|
|
106
110
|
pronto (~> 0.9.0)
|
107
111
|
rubocop (~> 0.50, >= 0.49.1)
|
108
112
|
public_suffix (3.0.3)
|
109
|
-
rails_best_practices (1.19.
|
113
|
+
rails_best_practices (1.19.4)
|
110
114
|
activesupport
|
111
115
|
code_analyzer (>= 0.4.8)
|
112
116
|
erubis
|
@@ -116,8 +120,8 @@ GEM
|
|
116
120
|
ruby-progressbar
|
117
121
|
rainbow (2.2.2)
|
118
122
|
rake
|
119
|
-
rake (
|
120
|
-
reek (5.0
|
123
|
+
rake (12.3.2)
|
124
|
+
reek (5.2.0)
|
121
125
|
codeclimate-engine-rb (~> 0.4.0)
|
122
126
|
kwalify (~> 0.7.0)
|
123
127
|
parser (>= 2.5.0.0, < 2.6, != 2.5.1.1)
|
@@ -136,20 +140,20 @@ GEM
|
|
136
140
|
diff-lcs (>= 1.2.0, < 2.0)
|
137
141
|
rspec-support (~> 3.8.0)
|
138
142
|
rspec-support (3.8.0)
|
139
|
-
rspec_junit_formatter (0.
|
143
|
+
rspec_junit_formatter (0.4.1)
|
140
144
|
rspec-core (>= 2, < 4, != 2.12.0)
|
141
|
-
rubocop (0.
|
145
|
+
rubocop (0.61.1)
|
142
146
|
jaro_winkler (~> 1.5.1)
|
143
147
|
parallel (~> 1.10)
|
144
148
|
parser (>= 2.5, != 2.5.1.1)
|
145
149
|
powerpack (~> 0.1)
|
146
150
|
rainbow (>= 2.2.2, < 4.0)
|
147
151
|
ruby-progressbar (~> 1.7)
|
148
|
-
unicode-display_width (~> 1.
|
152
|
+
unicode-display_width (~> 1.4.0)
|
149
153
|
ruby-progressbar (1.10.0)
|
150
154
|
ruby_parser (3.11.0)
|
151
155
|
sexp_processor (~> 4.9)
|
152
|
-
rugged (0.27.
|
156
|
+
rugged (0.27.7)
|
153
157
|
sawyer (0.8.1)
|
154
158
|
addressable (>= 2.3.5, < 2.6)
|
155
159
|
faraday (~> 0.8, < 1.0)
|
@@ -193,9 +197,9 @@ DEPENDENCIES
|
|
193
197
|
pronto-rails_best_practices
|
194
198
|
pronto-reek
|
195
199
|
pronto-rubocop
|
196
|
-
rake (~>
|
200
|
+
rake (~> 12.3)
|
197
201
|
rspec (~> 3.0)
|
198
|
-
rspec_junit_formatter (~> 0.
|
202
|
+
rspec_junit_formatter (~> 0.4.1)
|
199
203
|
rubocop
|
200
204
|
simplecov
|
201
205
|
simplecov-rcov
|
data/README.md
CHANGED
@@ -449,7 +449,7 @@ ActsAsTaggableOnMongoid::Models::Tag.most_used(10)
|
|
449
449
|
ActsAsTaggableOnMongoid::Models::Tag.least_used(10)
|
450
450
|
```
|
451
451
|
|
452
|
-
###
|
452
|
+
### Finding Tagged Objects
|
453
453
|
|
454
454
|
Acts As Taggable On uses scopes to create an association for tags.
|
455
455
|
This way you can mix and match to filter down your results.
|
@@ -684,6 +684,79 @@ CSS:
|
|
684
684
|
.css4 { font-size: 1.6em; }
|
685
685
|
```
|
686
686
|
|
687
|
+
### Custom Tag and Tagging tables
|
688
|
+
|
689
|
+
Each Tag that is defined allows you to specify a custom `Tags` or `Taggings` table for the data.
|
690
|
+
This allows you to add custom columns or features as needed.
|
691
|
+
|
692
|
+
#### Custom Tags
|
693
|
+
To create a custom `Tag`, you can either include `ActsAsTaggableOnMongoid::Models::Concerns::TagModel` or
|
694
|
+
you can include one or more of the sub-concerns to add the features you want to inherit and define your own
|
695
|
+
version of those features yourself. If you do not include the `TagModel` concern and you pick the modules
|
696
|
+
you want to add yourself, please note that the order of the included modules is important and that if you
|
697
|
+
do not include the modules in the order specified, some features may not perform as you expect in some
|
698
|
+
fringe cases.
|
699
|
+
|
700
|
+
Because the Tags tables and the Taggings tables refer to each other with the `taggings` and `tags` relationships
|
701
|
+
respectively, if you create a custom Tags table you should create a custom Taggings table as well. This means
|
702
|
+
that you will need to redefine the respective relationships in the two custom models.
|
703
|
+
|
704
|
+
```ruby
|
705
|
+
class CustomTag
|
706
|
+
include ActsAsTaggableOnMongoid::Models::Concerns::TagModel
|
707
|
+
|
708
|
+
has_many :taggings, dependent: :destroy, class_name: "CustomTagging"
|
709
|
+
end
|
710
|
+
|
711
|
+
class CustomTag
|
712
|
+
include ActsAsTaggableOnMongoid::Models::Concerns::TagFields
|
713
|
+
include ActsAsTaggableOnMongoid::Models::Concerns::TagMethods
|
714
|
+
|
715
|
+
has_many :taggings, dependent: :destroy, class_name: "CustomTagging"
|
716
|
+
|
717
|
+
include ActsAsTaggableOnMongoid::Models::Concerns::TagValidations
|
718
|
+
include ActsAsTaggableOnMongoid::Models::Concerns::TagScopes
|
719
|
+
end
|
720
|
+
```
|
721
|
+
|
722
|
+
#### Custom Taggings
|
723
|
+
To create a custom `Tagging`, you can either include `ActsAsTaggableOnMongoid::Models::Concerns::TaggingModel` or
|
724
|
+
you can include one or more of the sub-concerns to add the features you want to inherit and define your own
|
725
|
+
version of those features yourself. If you do not include the `TagModel` concern and you pick the modules
|
726
|
+
you want to add yourself, please note that the order of the included modules is important and that if you
|
727
|
+
do not include the modules in the order specified, some features may not perform as you expect in some
|
728
|
+
fringe cases.
|
729
|
+
|
730
|
+
Because the Tags tables and the Taggings tables refer to each other with the `taggings` and `tags` relationships
|
731
|
+
respectively, if you create a custom Taggings table you should create a custom Tags table as well. This means
|
732
|
+
that you will need to redefine the respective relationships in the two custom models.
|
733
|
+
|
734
|
+
NOTE: If you include the `TaggingAssociations` module, do NOT include the `counter_cache` option in the `belongs_to`
|
735
|
+
relationship for the `tag` or the `taggings_count` will be doubled. If you do not include that module, then you can
|
736
|
+
include it or not as you wish to get the count.
|
737
|
+
|
738
|
+
```ruby
|
739
|
+
class CustomTagging
|
740
|
+
include ActsAsTaggableOnMongoid::Models::Concerns::TaggingModel
|
741
|
+
|
742
|
+
# Do NOT include `counter_cache` here
|
743
|
+
belongs_to :tag, inverse_of: :taggings
|
744
|
+
end
|
745
|
+
|
746
|
+
class CustomTagging
|
747
|
+
include ActsAsTaggableOnMongoid::Models::Concerns::TaggingFields
|
748
|
+
include ActsAsTaggableOnMongoid::Models::Concerns::TaggingMethods
|
749
|
+
|
750
|
+
# `counter_cache` is optional here.
|
751
|
+
# `remove_unused_tags` will not work properly if this is not included though.
|
752
|
+
belongs_to :tag, counter_cache: true, inverse_of: :taggings
|
753
|
+
belongs_to :taggable, polymorphic: true
|
754
|
+
|
755
|
+
include ActsAsTaggableOnMongoid::Models::Concerns::TaggingValidations
|
756
|
+
include ActsAsTaggableOnMongoid::Models::Concerns::TaggingScopes
|
757
|
+
end
|
758
|
+
```
|
759
|
+
|
687
760
|
## Configuration
|
688
761
|
|
689
762
|
Configurations set on the `ActsAsTaggableOnMongoid` (also `ActsAsTaggableOnMongoid.configuration` or
|
@@ -45,9 +45,9 @@ Gem::Specification.new do |spec|
|
|
45
45
|
spec.add_development_dependency "pronto-rails_best_practices"
|
46
46
|
spec.add_development_dependency "pronto-reek"
|
47
47
|
spec.add_development_dependency "pronto-rubocop"
|
48
|
-
spec.add_development_dependency "rake", "~>
|
48
|
+
spec.add_development_dependency "rake", "~> 12.3"
|
49
49
|
spec.add_development_dependency "rspec", "~> 3.0"
|
50
|
-
spec.add_development_dependency "rspec_junit_formatter", "~> 0.
|
50
|
+
spec.add_development_dependency "rspec_junit_formatter", "~> 0.4.1"
|
51
51
|
spec.add_development_dependency "rubocop"
|
52
52
|
spec.add_development_dependency "simplecov"
|
53
53
|
spec.add_development_dependency "simplecov-rcov"
|
@@ -32,9 +32,9 @@ module ActsAsTaggableOnMongoid
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def create_tag(tag_definition, name)
|
35
|
-
tag_definition.tags_table.create(name: name,
|
36
|
-
|
37
|
-
|
35
|
+
tag_definition.tags_table.create!(name: name,
|
36
|
+
context: tag_definition.tag_type,
|
37
|
+
taggable_type: tag_definition.owner.name)
|
38
38
|
end
|
39
39
|
|
40
40
|
def as_8bit_ascii(string)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts-as-taggable-on-mongoid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.0.1.
|
4
|
+
version: 6.0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- RealNobody
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -204,14 +204,14 @@ dependencies:
|
|
204
204
|
requirements:
|
205
205
|
- - "~>"
|
206
206
|
- !ruby/object:Gem::Version
|
207
|
-
version: '
|
207
|
+
version: '12.3'
|
208
208
|
type: :development
|
209
209
|
prerelease: false
|
210
210
|
version_requirements: !ruby/object:Gem::Requirement
|
211
211
|
requirements:
|
212
212
|
- - "~>"
|
213
213
|
- !ruby/object:Gem::Version
|
214
|
-
version: '
|
214
|
+
version: '12.3'
|
215
215
|
- !ruby/object:Gem::Dependency
|
216
216
|
name: rspec
|
217
217
|
requirement: !ruby/object:Gem::Requirement
|
@@ -232,14 +232,14 @@ dependencies:
|
|
232
232
|
requirements:
|
233
233
|
- - "~>"
|
234
234
|
- !ruby/object:Gem::Version
|
235
|
-
version: 0.
|
235
|
+
version: 0.4.1
|
236
236
|
type: :development
|
237
237
|
prerelease: false
|
238
238
|
version_requirements: !ruby/object:Gem::Requirement
|
239
239
|
requirements:
|
240
240
|
- - "~>"
|
241
241
|
- !ruby/object:Gem::Version
|
242
|
-
version: 0.
|
242
|
+
version: 0.4.1
|
243
243
|
- !ruby/object:Gem::Dependency
|
244
244
|
name: rubocop
|
245
245
|
requirement: !ruby/object:Gem::Requirement
|