acts-as-taggable-on-mongoid 6.0.1.4 → 6.1.1.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +5 -5
  2. data/.circleci/config.yml +2 -1
  3. data/.rubocop.yml +402 -38
  4. data/.ruby-version +1 -1
  5. data/Gemfile.lock +110 -110
  6. data/README.md +103 -28
  7. data/acts-as-taggable-on-mongoid.gemspec +5 -5
  8. data/lib/acts-as-taggable-on-mongoid.rb +11 -4
  9. data/lib/acts_as_taggable_on_mongoid/models/concerns/tag_associations.rb +14 -0
  10. data/lib/acts_as_taggable_on_mongoid/models/concerns/tag_fields.rb +6 -1
  11. data/lib/acts_as_taggable_on_mongoid/models/concerns/tag_hooks.rb +68 -0
  12. data/lib/acts_as_taggable_on_mongoid/models/concerns/tag_methods.rb +36 -22
  13. data/lib/acts_as_taggable_on_mongoid/models/concerns/tag_migration.rb +46 -0
  14. data/lib/acts_as_taggable_on_mongoid/models/concerns/tag_model.rb +3 -0
  15. data/lib/acts_as_taggable_on_mongoid/models/concerns/tag_scopes.rb +5 -2
  16. data/lib/acts_as_taggable_on_mongoid/models/concerns/tag_validations.rb +3 -1
  17. data/lib/acts_as_taggable_on_mongoid/models/concerns/tagging_associations.rb +20 -2
  18. data/lib/acts_as_taggable_on_mongoid/models/concerns/tagging_fields.rb +6 -2
  19. data/lib/acts_as_taggable_on_mongoid/models/concerns/tagging_methods.rb +4 -2
  20. data/lib/acts_as_taggable_on_mongoid/models/concerns/tagging_migration.rb +46 -0
  21. data/lib/acts_as_taggable_on_mongoid/models/concerns/tagging_model.rb +2 -0
  22. data/lib/acts_as_taggable_on_mongoid/models/concerns/tagging_scopes.rb +9 -5
  23. data/lib/acts_as_taggable_on_mongoid/models/concerns/tagging_validations.rb +4 -6
  24. data/lib/acts_as_taggable_on_mongoid/tag_list.rb +91 -4
  25. data/lib/acts_as_taggable_on_mongoid/taggable.rb +22 -3
  26. data/lib/acts_as_taggable_on_mongoid/taggable/cache.rb +30 -0
  27. data/lib/acts_as_taggable_on_mongoid/taggable/changeable.rb +5 -4
  28. data/lib/acts_as_taggable_on_mongoid/taggable/core.rb +157 -34
  29. data/lib/acts_as_taggable_on_mongoid/taggable/list_tags.rb +1 -0
  30. data/lib/acts_as_taggable_on_mongoid/taggable/tag_type_definition.rb +43 -50
  31. data/lib/acts_as_taggable_on_mongoid/taggable/tag_type_definition/attributes.rb +70 -6
  32. data/lib/acts_as_taggable_on_mongoid/taggable/tag_type_definition/changeable.rb +52 -39
  33. data/lib/acts_as_taggable_on_mongoid/taggable/tag_type_definition/list_methods.rb +77 -0
  34. data/lib/acts_as_taggable_on_mongoid/taggable/tag_type_definition/names.rb +12 -0
  35. data/lib/acts_as_taggable_on_mongoid/taggable/tagged_with_query/all_tags_query.rb +1 -1
  36. data/lib/acts_as_taggable_on_mongoid/taggable/tagged_with_query/any_tags_query.rb +1 -1
  37. data/lib/acts_as_taggable_on_mongoid/taggable/tagged_with_query/exclude_tags_query.rb +1 -1
  38. data/lib/acts_as_taggable_on_mongoid/taggable/tagged_with_query/match_all_tags_query.rb +1 -1
  39. data/lib/acts_as_taggable_on_mongoid/taggable/tagger_relation.rb +53 -0
  40. data/lib/acts_as_taggable_on_mongoid/taggable/utils/tag_list_diff.rb +9 -7
  41. data/lib/acts_as_taggable_on_mongoid/tagger.rb +67 -0
  42. data/lib/acts_as_taggable_on_mongoid/tagger/tag_methods.rb +74 -0
  43. data/lib/acts_as_taggable_on_mongoid/tagger_tag_list.rb +171 -0
  44. data/lib/acts_as_taggable_on_mongoid/version.rb +1 -1
  45. metadata +43 -29
@@ -1 +1 @@
1
- 2.3.1
1
+ 2.7.1
@@ -1,179 +1,179 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- acts-as-taggable-on-mongoid (6.0.1.4)
5
- activesupport (~> 4.2)
6
- mongoid (~> 5.2)
4
+ acts-as-taggable-on-mongoid (6.1.1.11)
5
+ activesupport (>= 5.0)
6
+ mongoid (>= 6.1.1, <= 7.0.2)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- activemodel (4.2.10)
12
- activesupport (= 4.2.10)
13
- builder (~> 3.1)
14
- activesupport (4.2.10)
15
- i18n (~> 0.7)
11
+ activemodel (5.2.4.3)
12
+ activesupport (= 5.2.4.3)
13
+ activesupport (5.2.4.3)
14
+ concurrent-ruby (~> 1.0, >= 1.0.2)
15
+ i18n (>= 0.7, < 2)
16
16
  minitest (~> 5.1)
17
- thread_safe (~> 0.3, >= 0.3.4)
18
17
  tzinfo (~> 1.1)
19
- addressable (2.5.2)
20
- public_suffix (>= 2.0.2, < 4.0)
21
- ast (2.4.0)
18
+ addressable (2.7.0)
19
+ public_suffix (>= 2.0.2, < 5.0)
20
+ ast (2.4.1)
22
21
  axiom-types (0.1.1)
23
22
  descendants_tracker (~> 0.0.4)
24
23
  ice_nine (~> 0.11.0)
25
24
  thread_safe (~> 0.3, >= 0.3.1)
26
- brakeman (4.3.1)
27
- bson (4.3.0)
28
- builder (3.2.3)
29
- code_analyzer (0.4.8)
25
+ brakeman (4.10.0)
26
+ bson (4.8.2)
27
+ code_analyzer (0.5.2)
30
28
  sexp_processor
31
29
  codeclimate-engine-rb (0.4.1)
32
30
  virtus (~> 1.0)
33
- codecov (0.1.14)
31
+ codecov (0.2.12)
34
32
  json
35
33
  simplecov
36
- url
37
34
  coercible (1.0.0)
38
35
  descendants_tracker (~> 0.0.1)
39
36
  colorize (0.8.1)
40
- concurrent-ruby (1.1.3)
41
- cornucopia (0.1.55)
42
- activesupport (< 5.0)
43
- database_cleaner (1.7.0)
37
+ concurrent-ruby (1.1.7)
38
+ cornucopia (0.1.56)
39
+ activesupport (> 4.0, < 6.0)
40
+ database_cleaner (1.8.5)
44
41
  descendants_tracker (0.0.4)
45
42
  thread_safe (~> 0.3, >= 0.3.1)
46
- diff-lcs (1.3)
47
- docile (1.3.1)
43
+ diff-lcs (1.4.4)
44
+ docile (1.3.2)
48
45
  equalizer (0.0.11)
49
46
  erubis (2.7.0)
50
- faraday (0.15.4)
47
+ faraday (1.0.1)
51
48
  multipart-post (>= 1.2, < 3)
52
- fasterer (0.4.1)
49
+ fasterer (0.8.3)
53
50
  colorize (~> 0.7)
54
- ruby_parser (~> 3.11.0)
55
- gem-release (2.0.1)
56
- gitlab (4.7.0)
57
- httparty (>= 0.14.0)
58
- terminal-table (>= 1.5.1)
59
- httparty (0.16.3)
51
+ ruby_parser (>= 3.14.1)
52
+ gem-release (2.2.0)
53
+ gitlab (4.16.1)
54
+ httparty (~> 0.14, >= 0.14.0)
55
+ terminal-table (~> 1.5, >= 1.5.1)
56
+ httparty (0.18.1)
60
57
  mime-types (~> 3.0)
61
58
  multi_xml (>= 0.5.2)
62
- i18n (0.9.5)
59
+ i18n (1.8.2)
63
60
  concurrent-ruby (~> 1.0)
64
61
  ice_nine (0.11.2)
65
- jaro_winkler (1.5.1)
66
- json (2.1.0)
62
+ json (2.3.1)
67
63
  kwalify (0.7.2)
68
- mime-types (3.2.2)
64
+ mime-types (3.3.1)
69
65
  mime-types-data (~> 3.2015)
70
- mime-types-data (3.2018.0812)
71
- minitest (5.11.3)
72
- mongo (2.6.2)
73
- bson (>= 4.3.0, < 5.0.0)
74
- mongoid (5.4.0)
75
- activemodel (~> 4.0)
66
+ mime-types-data (3.2020.0512)
67
+ minitest (5.14.2)
68
+ mongo (2.13.1)
69
+ bson (>= 4.8.2, < 5.0.0)
70
+ mongoid (7.0.2)
71
+ activemodel (>= 5.1, < 6.0.0)
76
72
  mongo (>= 2.5.1, < 3.0.0)
77
- origin (~> 2.3)
78
- tzinfo (>= 0.3.37)
79
73
  multi_xml (0.6.0)
80
- multipart-post (2.0.0)
81
- octokit (4.13.0)
74
+ multipart-post (2.1.1)
75
+ octokit (4.18.0)
76
+ faraday (>= 0.9)
82
77
  sawyer (~> 0.8.0, >= 0.5.3)
83
- origin (2.3.1)
84
- parallel (1.12.1)
85
- parser (2.5.3.0)
86
- ast (~> 2.4.0)
87
- powerpack (0.1.2)
88
- pronto (0.9.5)
78
+ parallel (1.19.2)
79
+ parser (2.7.2.0)
80
+ ast (~> 2.4.1)
81
+ pronto (0.10.0)
89
82
  gitlab (~> 4.0, >= 4.0.0)
90
83
  httparty (>= 0.13.7)
91
84
  octokit (~> 4.7, >= 4.7.0)
92
- rainbow (~> 2.1)
85
+ rainbow (>= 2.2, < 4.0)
93
86
  rugged (~> 0.24, >= 0.23.0)
94
- thor (~> 0.19.0)
95
- pronto-brakeman (0.9.1)
87
+ thor (~> 0.20.0)
88
+ pronto-brakeman (0.10.0)
96
89
  brakeman (>= 3.2.0)
97
- pronto (~> 0.9.0)
90
+ pronto (~> 0.10.0)
98
91
  pronto-circleci (1.0.1)
99
92
  pronto (~> 0.9)
100
- pronto-fasterer (0.9.0)
93
+ pronto-fasterer (0.10.0)
101
94
  fasterer (~> 0.3, >= 0.3.0)
102
- pronto (~> 0.9.0)
103
- pronto-rails_best_practices (0.9.0)
104
- pronto (~> 0.9.0)
95
+ pronto (~> 0.10.0)
96
+ pronto-rails_best_practices (0.10.0)
97
+ pronto (~> 0.10.0)
105
98
  rails_best_practices (~> 1.16, >= 1.15.0)
106
- pronto-reek (0.9.1)
107
- pronto (~> 0.9.0)
99
+ pronto-reek (0.10.0)
100
+ pronto (~> 0.10.0)
108
101
  reek (>= 4.2, < 6.0)
109
- pronto-rubocop (0.9.1)
110
- pronto (~> 0.9.0)
102
+ pronto-rubocop (0.10.0)
103
+ pronto (~> 0.10.0)
111
104
  rubocop (~> 0.50, >= 0.49.1)
112
- public_suffix (3.0.3)
113
- rails_best_practices (1.19.4)
105
+ psych (3.1.0)
106
+ public_suffix (4.0.6)
107
+ rails_best_practices (1.20.0)
114
108
  activesupport
115
- code_analyzer (>= 0.4.8)
109
+ code_analyzer (>= 0.5.1)
116
110
  erubis
117
111
  i18n
118
112
  json
119
- require_all (~> 2.0)
113
+ require_all (~> 3.0)
120
114
  ruby-progressbar
121
- rainbow (2.2.2)
122
- rake
123
- rake (12.3.2)
124
- reek (5.2.0)
115
+ rainbow (3.0.0)
116
+ rake (13.0.1)
117
+ reek (5.6.0)
125
118
  codeclimate-engine-rb (~> 0.4.0)
126
119
  kwalify (~> 0.7.0)
127
- parser (>= 2.5.0.0, < 2.6, != 2.5.1.1)
120
+ parser (>= 2.5.0.0, < 2.8, != 2.5.1.1)
121
+ psych (~> 3.1.0)
128
122
  rainbow (>= 2.0, < 4.0)
129
- require_all (2.0.0)
130
- rspec (3.8.0)
131
- rspec-core (~> 3.8.0)
132
- rspec-expectations (~> 3.8.0)
133
- rspec-mocks (~> 3.8.0)
134
- rspec-core (3.8.0)
135
- rspec-support (~> 3.8.0)
136
- rspec-expectations (3.8.1)
123
+ regexp_parser (1.8.2)
124
+ require_all (3.0.0)
125
+ rexml (3.2.4)
126
+ rspec (3.9.0)
127
+ rspec-core (~> 3.9.0)
128
+ rspec-expectations (~> 3.9.0)
129
+ rspec-mocks (~> 3.9.0)
130
+ rspec-core (3.9.3)
131
+ rspec-support (~> 3.9.3)
132
+ rspec-expectations (3.9.2)
137
133
  diff-lcs (>= 1.2.0, < 2.0)
138
- rspec-support (~> 3.8.0)
139
- rspec-mocks (3.8.0)
134
+ rspec-support (~> 3.9.0)
135
+ rspec-mocks (3.9.1)
140
136
  diff-lcs (>= 1.2.0, < 2.0)
141
- rspec-support (~> 3.8.0)
142
- rspec-support (3.8.0)
137
+ rspec-support (~> 3.9.0)
138
+ rspec-support (3.9.3)
143
139
  rspec_junit_formatter (0.4.1)
144
140
  rspec-core (>= 2, < 4, != 2.12.0)
145
- rubocop (0.61.1)
146
- jaro_winkler (~> 1.5.1)
141
+ rubocop (0.92.0)
147
142
  parallel (~> 1.10)
148
- parser (>= 2.5, != 2.5.1.1)
149
- powerpack (~> 0.1)
143
+ parser (>= 2.7.1.5)
150
144
  rainbow (>= 2.2.2, < 4.0)
145
+ regexp_parser (>= 1.7)
146
+ rexml
147
+ rubocop-ast (>= 0.5.0)
151
148
  ruby-progressbar (~> 1.7)
152
- unicode-display_width (~> 1.4.0)
153
- ruby-progressbar (1.10.0)
154
- ruby_parser (3.11.0)
149
+ unicode-display_width (>= 1.4.0, < 2.0)
150
+ rubocop-ast (0.8.0)
151
+ parser (>= 2.7.1.5)
152
+ rubocop-performance (1.8.1)
153
+ rubocop (>= 0.87.0)
154
+ rubocop-ast (>= 0.4.0)
155
+ ruby-progressbar (1.10.1)
156
+ ruby_parser (3.15.0)
155
157
  sexp_processor (~> 4.9)
156
- rugged (0.27.7)
157
- sawyer (0.8.1)
158
- addressable (>= 2.3.5, < 2.6)
159
- faraday (~> 0.8, < 1.0)
160
- sexp_processor (4.11.0)
161
- simplecov (0.16.1)
158
+ rugged (0.99.0)
159
+ sawyer (0.8.2)
160
+ addressable (>= 2.3.5)
161
+ faraday (> 0.8, < 2.0)
162
+ sexp_processor (4.15.1)
163
+ simplecov (0.19.0)
162
164
  docile (~> 1.1)
163
- json (>= 1.8, < 3)
164
- simplecov-html (~> 0.10.0)
165
- simplecov-html (0.10.2)
165
+ simplecov-html (~> 0.11)
166
+ simplecov-html (0.12.3)
166
167
  simplecov-rcov (0.2.3)
167
168
  simplecov (>= 0.4.1)
168
169
  terminal-table (1.8.0)
169
170
  unicode-display_width (~> 1.1, >= 1.1.1)
170
- thor (0.19.4)
171
+ thor (0.20.3)
171
172
  thread_safe (0.3.6)
172
- timecop (0.9.1)
173
- tzinfo (1.2.5)
173
+ timecop (0.9.2)
174
+ tzinfo (1.2.7)
174
175
  thread_safe (~> 0.1)
175
- unicode-display_width (1.4.0)
176
- url (0.3.2)
176
+ unicode-display_width (1.7.0)
177
177
  virtus (1.0.5)
178
178
  axiom-types (~> 0.1)
179
179
  coercible (~> 1.0)
@@ -185,8 +185,7 @@ PLATFORMS
185
185
 
186
186
  DEPENDENCIES
187
187
  acts-as-taggable-on-mongoid!
188
- bundler (~> 1.16)
189
- codecov (~> 0.1.0, ~> 0.1)
188
+ codecov (~> 0.2.2, ~> 0.1)
190
189
  cornucopia
191
190
  database_cleaner
192
191
  gem-release
@@ -197,13 +196,14 @@ DEPENDENCIES
197
196
  pronto-rails_best_practices
198
197
  pronto-reek
199
198
  pronto-rubocop
200
- rake (~> 12.3)
199
+ rake (~> 13.0)
201
200
  rspec (~> 3.0)
202
201
  rspec_junit_formatter (~> 0.4.1)
203
202
  rubocop
203
+ rubocop-performance
204
204
  simplecov
205
205
  simplecov-rcov
206
206
  timecop
207
207
 
208
208
  BUNDLED WITH
209
- 1.16.4
209
+ 2.1.4
data/README.md CHANGED
@@ -52,6 +52,13 @@ Or install it yourself as:
52
52
  **NOTE**: Unlike the `ActsAsTaggableOn` gem, I group Tags by context. Tags with the same
53
53
  name for different contexts keep separate counts and are considered different Tags.
54
54
  It is simpler to combine Tags and their counts by name then it is to split them out.
55
+ * **Tagger** - A database object which is given credit for creating a Tagging. This
56
+ object is an external model from this gem. Tagger objects can be specified
57
+ as being a Tagger using the `acts_as_tagger` method which allows a
58
+ Tagger object to `tag` Taggable objects.
59
+ * **Owner** - A database object which is given ownership of a Tag object.
60
+ This object is an external model from this gem. By default when Tags
61
+ are created, the owner of a Tag is the same as the Tagger for the Tagging.
55
62
 
56
63
  The database structure is:
57
64
  ```
@@ -183,6 +190,7 @@ end
183
190
  class MyTaggable
184
191
  include ::Mongoid::Document
185
192
 
193
+ # See lib/acts_as_taggable_on_mongoid/taggable.rb for more details on options.
186
194
  acts_as_taggable_on :my_tags,
187
195
  :your_tags,
188
196
  :other_tags,
@@ -559,7 +567,7 @@ ActsAsTaggableOnMongoid.default_parser = MyParser
559
567
  @user.tag_list # => ["east", "south"]
560
568
  ```
561
569
 
562
- ### ~~Tag Ownership~~ Not implimented yet
570
+ ### Tag Ownership
563
571
 
564
572
  Tags can have owners:
565
573
 
@@ -577,45 +585,97 @@ end
577
585
  @some_user.owned_tags
578
586
  Photo.tagged_with("paris", :on => :locations, :owned_by => @some_user)
579
587
  @some_photo.locations_from(@some_user) # => ["paris", "normandy"]
580
- @some_photo.owner_tags_on(@some_user, :locations) # => [#<ActsAsTaggableOnMongoid::Models::Tag id: 1, name: "paris">...]
581
- @some_photo.owner_tags_on(nil, :locations) # => Ownerships equivalent to saying @some_photo.locations
588
+ @some_photo.tagger_location_lists[@some_user] # => [#<ActsAsTaggableOnMongoid::Models::Tag id: 1, name: "paris">...]
589
+ @some_photo.tagger_location_lists[nil] # => Ownerships equivalent to saying @some_photo.locations
582
590
  @some_user.tag(@some_photo, :with => "paris, normandy", :on => :locations, :skip_save => true) #won't save @some_photo object
583
591
  ```
584
592
 
585
593
  #### Working with Owned Tags
586
- Note that `tag_list` only returns tags whose taggings do not have an owner. Continuing from the above example:
594
+ Note that by default `tag_list` only returns tags whose taggings do not
595
+ have an owner. Continuing from the above example:
587
596
  ```ruby
588
597
  @some_photo.tag_list # => []
589
598
  ```
590
- To retrieve all tags of an object (regardless of ownership) or if only one owner can tag the object, use `all_tags_list`.
599
+ To retrieve all tags of an object (regardless of ownership) or if only
600
+ one owner can tag the object, you can use `all_tags_list`.
591
601
 
592
- ##### Adding owned tags
593
- Note that **owned tags** are added all at once, in the form of ***comma seperated tags*** in string.
594
- Also, when you try to add **owned tags** again, it simply overwrites the previous set of **owned tags**.
595
- So to append tags in previously existing **owned tags** list, go as follows:
602
+ Tags are stored in a Hash grouped by `Tagger`. You can access this list
603
+ using `tagger_<tag_type>_lists`. This allows you to directly access and
604
+ use the `TagList` for any owner just like you would the `<tag_type>_list`
605
+ methods.
606
+
607
+ Examples:
596
608
  ```ruby
597
- def add_owned_tag
598
- @some_item = Item.find(params[:id])
599
- owned_tag_list = @some_item.all_tags_list - @some_item.tag_list
600
- owned_tag_list += [(params[:tag])]
601
- @tag_owner.tag(@some_item, :with => stringify(owned_tag_list), :on => :tags)
602
- @some_item.save
603
- end
609
+ tag_lists = @some_photo.tagger_location_lists
610
+ tag_lists.keys # => [@some_user]
611
+
612
+ # Add tags for @some_user
613
+ tag_lists[@some_user].add "berlin, london", parse: true
614
+ # Remove tags for @some_user
615
+ tag_lists[@some_user].remove "paris"
616
+ # Set the list for @some_user (replacing existing tags)
617
+ tag_lists[@some_user] = "new york, chicago, brussels, rome"
618
+
619
+ # Add tags for a new owner:
620
+ tag_lists[@other_user] = "moscow, bejing, tokyo"
621
+ ```
622
+ #### Owned Tags and defaults
623
+
624
+ Owned Tags can be difficult to work with having to manage owners
625
+ manually. To ease that process, I have added the concept of defaults
626
+ to use when working with Owned tags.
627
+
628
+ When a tag is defined, you can also define default behavior when
629
+ creating the tag and accessing it, simplifying using the tag in
630
+ everyday access.
631
+
632
+ Options:
633
+ * tagger: true - Simply defines that a Tag definition supports
634
+ the concept of Taggers and allows setting the Tagger for a list.
635
+ * tagger: { default_tagger: :method_name} - This allows you to
636
+ specify that when a Tagging is created on a Taggable object
637
+ that the Taggable object will supply the default tagger using
638
+ the indicated method.
639
+ * tagger: { tag_list_uses_default_tagger: true } - A
640
+ shortcut/syntax sugar to treat `<tag_type>_list` to return
641
+ the tags for the `default_tagger` instead of no taggers
604
642
 
605
- def stringify(tag_list)
606
- tag_list.inject('') { |memo, tag| memo += (tag + ',') }[0..-1]
607
- end
608
- ```
609
- ##### Removing owned tags
610
- Similarly as above, removing will be as follows:
611
643
  ```ruby
612
- def remove_owned_tag
613
- @some_item = Item.find(params[:id])
614
- owned_tag_list = @some_item.all_tags_list - @some_item.tag_list
615
- owned_tag_list -= [(params[:tag])]
616
- @tag_owner.tag(@some_item, :with => stringify(owned_tag_list), :on => :tags)
617
- @some_item.save
644
+ class Car
645
+ acts_as_taggable_on tagger: { default_tagger: :owner, tag_list_uses_default_tagger: true }
646
+
647
+ belongs_to :owner, class_name: "User"
618
648
  end
649
+
650
+ class User
651
+ acts_as_tagger
652
+
653
+ has_many :cars
654
+ end
655
+
656
+ car = @some_user.cars.first
657
+ car.tag_list = "antique, warrantied, registered"
658
+ car.tag_lists[car.owner] # => ["antique", "warrantied", "registerd"]
659
+ car.tag_lists[nil] # => []
660
+
661
+ car.tag_lists[@potential_buyer] = ["inspected", "test drove", "good value"]
662
+ car.tagger_tag_list(@potential_buyer) # => ["inspected", "test drove", "good value"]
663
+
664
+ all_list = car.all_tag_list # => ["antique", "warrantied", "registerd", "inspected", "test drove", "good value"]
665
+ all_list.tagger # => @some_user
666
+
667
+ # Changing `all_list` does NOT affect/change the tags on `car`
668
+ # Changing other lists will:
669
+ all_list.remove "warrantied", "test drove"
670
+ car.tag_lists[car.owner] # => ["antique", "warrantied", "registerd"]
671
+ car.tagger_tag_list(@potential_buyer) # => ["inspected", "test drove", "good value"]
672
+ car.all_tag_list # => ["antique", "warrantied", "registerd", "inspected", "test drove", "good value"]
673
+
674
+ car.tag_lists[car.owner].add "deposit"
675
+ car.tagger_tag_list(@potential_buyer).remove "good value"
676
+ car.tag_lists[car.owner] # => ["antique", "warrantied", "registerd", "deposit"]
677
+ car.tagger_tag_list(@potential_buyer) # => ["inspected", "test drove"]
678
+ car.all_tag_list # => ["antique", "warrantied", "registerd", "deposit", "inspected", "test drove"]
619
679
  ```
620
680
 
621
681
  ### Dirty objects
@@ -634,6 +694,21 @@ end
634
694
  @bobby.skill_list_change.should == ["jogging, diving", ["swimming"]]
635
695
  ```
636
696
 
697
+ If the object allows for Taggers, there could be multiple Taggers each
698
+ with their own changes. In this case, the changes (and corresponding
699
+ was values) will be hashes of the Tagger and the tag lists.
700
+
701
+ ```ruby
702
+ @bobby = User.find_by_name("Bobby")
703
+ @bobby.skill_list_from(@teacher).add "attentive, assertive, gold star", parse: true
704
+ @bobby.skill_list_from(@parent).add "forger, standing in corner, truant", parse: true
705
+
706
+ @bobby.skill_list_change
707
+ # => [ {},
708
+ # => { @teacher => ["attentive", "assertive", "gold star"],
709
+ # => @parent => ["forger", "standing in corner", "truant"] } ]
710
+ ```
711
+
637
712
  ### ~~Tag cloud calculations~~ Not implimented yet
638
713
 
639
714
  To construct tag clouds, the frequency of each tag needs to be calculated.