acts-as-taggable-on 12.0.0 → 13.0.0

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.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/lib/acts-as-taggable-on/tag.rb +5 -13
  3. data/lib/acts-as-taggable-on/tag_list.rb +1 -1
  4. data/lib/acts-as-taggable-on/taggable/core.rb +0 -3
  5. data/lib/acts-as-taggable-on/taggable/tagged_with_query.rb +0 -5
  6. data/lib/acts-as-taggable-on/version.rb +1 -1
  7. data/lib/acts-as-taggable-on.rb +1 -1
  8. metadata +10 -170
  9. data/.github/workflows/spec.yml +0 -73
  10. data/.gitignore +0 -13
  11. data/.rspec +0 -2
  12. data/Appraisals +0 -23
  13. data/CHANGELOG.md +0 -379
  14. data/CONTRIBUTING.md +0 -57
  15. data/Gemfile +0 -11
  16. data/Guardfile +0 -5
  17. data/README.md +0 -596
  18. data/Rakefile +0 -21
  19. data/acts-as-taggable-on.gemspec +0 -32
  20. data/docker-compose.yml +0 -15
  21. data/gemfiles/activerecord_7.1.gemfile +0 -18
  22. data/gemfiles/activerecord_7.2.gemfile +0 -18
  23. data/gemfiles/activerecord_8.0.gemfile +0 -19
  24. data/spec/acts_as_taggable_on/acts_as_taggable_on_spec.rb +0 -272
  25. data/spec/acts_as_taggable_on/acts_as_tagger_spec.rb +0 -112
  26. data/spec/acts_as_taggable_on/caching_spec.rb +0 -125
  27. data/spec/acts_as_taggable_on/default_parser_spec.rb +0 -47
  28. data/spec/acts_as_taggable_on/dirty_spec.rb +0 -142
  29. data/spec/acts_as_taggable_on/generic_parser_spec.rb +0 -14
  30. data/spec/acts_as_taggable_on/related_spec.rb +0 -99
  31. data/spec/acts_as_taggable_on/single_table_inheritance_spec.rb +0 -231
  32. data/spec/acts_as_taggable_on/tag_list_spec.rb +0 -176
  33. data/spec/acts_as_taggable_on/tag_spec.rb +0 -398
  34. data/spec/acts_as_taggable_on/taggable_spec.rb +0 -828
  35. data/spec/acts_as_taggable_on/tagger_spec.rb +0 -153
  36. data/spec/acts_as_taggable_on/tagging_spec.rb +0 -169
  37. data/spec/acts_as_taggable_on/tags_helper_spec.rb +0 -45
  38. data/spec/acts_as_taggable_on/utils_spec.rb +0 -23
  39. data/spec/internal/app/models/altered_inheriting_taggable_model.rb +0 -5
  40. data/spec/internal/app/models/cached_model.rb +0 -3
  41. data/spec/internal/app/models/cached_model_with_array.rb +0 -11
  42. data/spec/internal/app/models/columns_override_model.rb +0 -5
  43. data/spec/internal/app/models/company.rb +0 -15
  44. data/spec/internal/app/models/inheriting_taggable_model.rb +0 -4
  45. data/spec/internal/app/models/market.rb +0 -2
  46. data/spec/internal/app/models/non_standard_id_taggable_model.rb +0 -8
  47. data/spec/internal/app/models/ordered_taggable_model.rb +0 -4
  48. data/spec/internal/app/models/other_cached_model.rb +0 -3
  49. data/spec/internal/app/models/other_taggable_model.rb +0 -4
  50. data/spec/internal/app/models/student.rb +0 -4
  51. data/spec/internal/app/models/taggable_model.rb +0 -16
  52. data/spec/internal/app/models/untaggable_model.rb +0 -3
  53. data/spec/internal/app/models/user.rb +0 -3
  54. data/spec/internal/config/database.yml.sample +0 -15
  55. data/spec/internal/db/schema.rb +0 -113
  56. data/spec/spec_helper.rb +0 -20
  57. data/spec/support/0-helpers.rb +0 -32
  58. data/spec/support/array.rb +0 -9
  59. data/spec/support/database.rb +0 -38
  60. data/spec/support/database_cleaner.rb +0 -25
data/README.md DELETED
@@ -1,596 +0,0 @@
1
- <!-- START doctoc generated TOC please keep comment here to allow auto update -->
2
- <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
3
- **Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*
4
-
5
- - [ActsAsTaggableOn](#actsastaggableon)
6
- - [Installation](#installation)
7
- - [Post Installation](#post-installation)
8
- - [For MySql users](#for-mysql-users)
9
- - [Usage](#usage)
10
- - [Finding most or least used tags](#finding-most-or-least-used-tags)
11
- - [Finding Tagged Objects](#finding-tagged-objects)
12
- - [Relationships](#relationships)
13
- - [Dynamic Tag Contexts](#dynamic-tag-contexts)
14
- - [Tag Parsers](#tag-parsers)
15
- - [Tag Ownership](#tag-ownership)
16
- - [Working with Owned Tags](#working-with-owned-tags)
17
- - [Adding owned tags](#adding-owned-tags)
18
- - [Removing owned tags](#removing-owned-tags)
19
- - [Dirty objects](#dirty-objects)
20
- - [Tag cloud calculations](#tag-cloud-calculations)
21
- - [Configuration](#configuration)
22
- - [Upgrading](#upgrading)
23
- - [Contributors](#contributors)
24
- - [Compatibility](#compatibility)
25
- - [Testing](#testing)
26
- - [License](#license)
27
-
28
- <!-- END doctoc generated TOC please keep comment here to allow auto update -->
29
-
30
- # ActsAsTaggableOn
31
-
32
- [![Join the chat at https://gitter.im/mbleigh/acts-as-taggable-on](https://badges.gitter.im/mbleigh/acts-as-taggable-on.svg)](https://gitter.im/mbleigh/acts-as-taggable-on?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
33
- [![Gem Version](https://badge.fury.io/rb/acts-as-taggable-on.svg)](http://badge.fury.io/rb/acts-as-taggable-on)
34
- [![Build Status](https://github.com/mbleigh/acts-as-taggable-on/workflows/spec/badge.svg)](https://github.com/mbleigh/acts-as-taggable-on/actions)
35
- [![Code Climate](https://codeclimate.com/github/mbleigh/acts-as-taggable-on.svg)](https://codeclimate.com/github/mbleigh/acts-as-taggable-on)
36
- [![Inline docs](http://inch-ci.org/github/mbleigh/acts-as-taggable-on.svg)](http://inch-ci.org/github/mbleigh/acts-as-taggable-on)
37
- [![Security](https://hakiri.io/github/mbleigh/acts-as-taggable-on/master.svg)](https://hakiri.io/github/mbleigh/acts-as-taggable-on/master)
38
-
39
- This plugin was originally based on Acts as Taggable on Steroids by Jonathan Viney.
40
- It has evolved substantially since that point, but all credit goes to him for the
41
- initial tagging functionality that so many people have used.
42
-
43
- For instance, in a social network, a user might have tags that are called skills,
44
- interests, sports, and more. There is no real way to differentiate between tags and
45
- so an implementation of this type is not possible with acts as taggable on steroids.
46
-
47
- Enter Acts as Taggable On. Rather than tying functionality to a specific keyword
48
- (namely `tags`), acts as taggable on allows you to specify an arbitrary number of
49
- tag "contexts" that can be used locally or in combination in the same way steroids
50
- was used.
51
-
52
-
53
-
54
- ## Installation
55
-
56
- To use it, add it to your Gemfile:
57
-
58
- ```ruby
59
- gem 'acts-as-taggable-on'
60
- ```
61
-
62
- and bundle:
63
-
64
- ```shell
65
- bundle
66
- ```
67
-
68
- #### Post Installation
69
-
70
- Install migrations
71
-
72
- ```shell
73
- # For the latest versions :
74
- rake acts_as_taggable_on_engine:install:migrations
75
- ```
76
-
77
- Review the generated migrations then migrate :
78
- ```shell
79
- rake db:migrate
80
- ```
81
-
82
- If you do not wish or need to support multi-tenancy, the migration for `add_tenant_to_taggings` is optional and can be discarded safely.
83
-
84
- #### For MySql users
85
- You can circumvent at any time the problem of special characters [issue 623](https://github.com/mbleigh/acts-as-taggable-on/issues/623) by setting in an initializer file:
86
-
87
- ```ruby
88
- ActsAsTaggableOn.force_binary_collation = true
89
- ```
90
-
91
- Or by running this rake task:
92
-
93
- ```shell
94
- rake acts_as_taggable_on_engine:tag_names:collate_bin
95
- ```
96
-
97
- See the Configuration section for more details, and a general note valid for older
98
- version of the gem.
99
-
100
-
101
- ## Usage
102
-
103
- Setup
104
-
105
- ```ruby
106
- class User < ActiveRecord::Base
107
- acts_as_taggable_on :tags
108
- acts_as_taggable_on :skills, :interests #You can also configure multiple tag types per model
109
- end
110
-
111
- class UsersController < ApplicationController
112
- def user_params
113
- params.require(:user).permit(:name, :tag_list) ## Rails 4 strong params usage
114
- end
115
- end
116
-
117
- @user = User.new(:name => "Bobby")
118
- ```
119
-
120
- Add and remove a single tag
121
-
122
- ```ruby
123
- @user.tag_list.add("awesome") # add a single tag. alias for <<
124
- @user.tag_list.remove("awesome") # remove a single tag
125
- @user.save # save to persist tag_list
126
- ```
127
-
128
- Add and remove multiple tags in an array
129
-
130
- ```ruby
131
- @user.tag_list.add("awesome", "slick")
132
- @user.tag_list.remove("awesome", "slick")
133
- @user.save
134
- ```
135
-
136
- You can also add and remove tags in format of String. This would
137
- be convenient in some cases such as handling tag input param in a String.
138
-
139
- Pay attention you need to add `parse: true` as option in this case.
140
-
141
- You may also want to take a look at delimiter in the string. The default
142
- is comma `,` so you don't need to do anything here. However, if you made
143
- a change on delimiter setting, make sure the string will match. See
144
- [configuration](#configuration) for more about delimiter.
145
-
146
- ```ruby
147
- @user.tag_list.add("awesome, slick", parse: true)
148
- @user.tag_list.remove("awesome, slick", parse: true)
149
- ```
150
-
151
- You can also add and remove tags by direct assignment. Note this will
152
- remove existing tags so use it with attention.
153
-
154
- ```ruby
155
- @user.tag_list = "awesome, slick, hefty"
156
- @user.save
157
- @user.reload
158
- @user.tags
159
- => [#<ActsAsTaggableOn::Tag id: 1, name: "awesome", taggings_count: 1>,
160
- #<ActsAsTaggableOn::Tag id: 2, name: "slick", taggings_count: 1>,
161
- #<ActsAsTaggableOn::Tag id: 3, name: "hefty", taggings_count: 1>]
162
- ```
163
-
164
- With the defined context in model, you have multiple new methods at disposal
165
- to manage and view the tags in the context. For example, with `:skill` context
166
- these methods are added to the model: `skill_list`(and `skill_list.add`, `skill_list.remove`
167
- `skill_list=`), `skills`(plural), `skill_counts`.
168
-
169
- ```ruby
170
- @user.skill_list = "joking, clowning, boxing"
171
- @user.save
172
- @user.reload
173
- @user.skills
174
- => [#<ActsAsTaggableOn::Tag id: 1, name: "joking", taggings_count: 1>,
175
- #<ActsAsTaggableOn::Tag id: 2, name: "clowning", taggings_count: 1>,
176
- #<ActsAsTaggableOn::Tag id: 3, name: "boxing", taggings_count: 1>]
177
-
178
- @user.skill_list.add("coding")
179
-
180
- @user.skill_list
181
- # => ["joking", "clowning", "boxing", "coding"]
182
-
183
- @another_user = User.new(:name => "Alice")
184
- @another_user.skill_list.add("clowning")
185
- @another_user.save
186
-
187
- User.skill_counts
188
- => [#<ActsAsTaggableOn::Tag id: 1, name: "joking", taggings_count: 1>,
189
- #<ActsAsTaggableOn::Tag id: 2, name: "clowning", taggings_count: 2>,
190
- #<ActsAsTaggableOn::Tag id: 3, name: "boxing", taggings_count: 1>]
191
- ```
192
-
193
- To preserve the order in which tags are created use `acts_as_ordered_taggable`:
194
-
195
- ```ruby
196
- class User < ActiveRecord::Base
197
- # Alias for acts_as_ordered_taggable_on :tags
198
- acts_as_ordered_taggable
199
- acts_as_ordered_taggable_on :skills, :interests
200
- end
201
-
202
- @user = User.new(:name => "Bobby")
203
- @user.tag_list = "east, south"
204
- @user.save
205
-
206
- @user.tag_list = "north, east, south, west"
207
- @user.save
208
-
209
- @user.reload
210
- @user.tag_list # => ["north", "east", "south", "west"]
211
- ```
212
-
213
- ### Finding most or least used tags
214
-
215
- You can find the most or least used tags by using:
216
-
217
- ```ruby
218
- ActsAsTaggableOn::Tag.most_used
219
- ActsAsTaggableOn::Tag.least_used
220
- ```
221
-
222
- You can also filter the results by passing the method a limit, however the default limit is 20.
223
-
224
- ```ruby
225
- ActsAsTaggableOn::Tag.most_used(10)
226
- ActsAsTaggableOn::Tag.least_used(10)
227
- ```
228
-
229
- ### Finding Tagged Objects
230
-
231
- Acts As Taggable On uses scopes to create an association for tags.
232
- This way you can mix and match to filter down your results.
233
-
234
- ```ruby
235
- class User < ActiveRecord::Base
236
- acts_as_taggable_on :tags, :skills
237
- scope :by_join_date, order("created_at DESC")
238
- end
239
-
240
- User.tagged_with("awesome").by_join_date
241
- User.tagged_with("awesome").by_join_date.paginate(:page => params[:page], :per_page => 20)
242
-
243
- # Find users that matches all given tags:
244
- # NOTE: This only matches users that have the exact set of specified tags. If a user has additional tags, they are not returned.
245
- User.tagged_with(["awesome", "cool"], :match_all => true)
246
-
247
- # Find users with any of the specified tags:
248
- User.tagged_with(["awesome", "cool"], :any => true)
249
-
250
- # Find users that have not been tagged with awesome or cool:
251
- User.tagged_with(["awesome", "cool"], :exclude => true)
252
-
253
- # Find users with any of the tags based on context:
254
- User.tagged_with(['awesome', 'cool'], :on => :tags, :any => true).tagged_with(['smart', 'shy'], :on => :skills, :any => true)
255
- ```
256
-
257
- #### Wildcard tag search
258
- You now have the following options for prefix, suffix and containment search, along with `:any` or `:exclude` option.
259
- Use `wild: :suffix` to place a wildcard at the end of the tag. It will be looking for `awesome%` and `cool%` in SQL.
260
- Use `wild: :prefix` to place a wildcard at the beginning of the tag. It will be looking for `%awesome` and `%cool` in SQL.
261
- Use `wild: true` to place a wildcard both at the beginning and the end of the tag. It will be looking for `%awesome%` and `%cool%` in SQL.
262
-
263
- __Tip:__ `User.tagged_with([])` or `User.tagged_with('')` will return `[]`, an empty set of records.
264
-
265
-
266
- ### Relationships
267
-
268
- You can find objects of the same type based on similar tags on certain contexts.
269
- Also, objects will be returned in descending order based on the total number of
270
- matched tags.
271
-
272
- ```ruby
273
- @bobby = User.find_by_name("Bobby")
274
- @bobby.skill_list # => ["jogging", "diving"]
275
-
276
- @frankie = User.find_by_name("Frankie")
277
- @frankie.skill_list # => ["hacking"]
278
-
279
- @tom = User.find_by_name("Tom")
280
- @tom.skill_list # => ["hacking", "jogging", "diving"]
281
-
282
- @tom.find_related_skills # => [<User name="Bobby">, <User name="Frankie">]
283
- @bobby.find_related_skills # => [<User name="Tom">]
284
- @frankie.find_related_skills # => [<User name="Tom">]
285
- ```
286
-
287
- ### Dynamic Tag Contexts
288
-
289
- In addition to the generated tag contexts in the definition, it is also possible
290
- to allow for dynamic tag contexts (this could be user generated tag contexts!)
291
-
292
- ```ruby
293
- @user = User.new(:name => "Bobby")
294
- @user.set_tag_list_on(:customs, "same, as, tag, list")
295
- @user.tag_list_on(:customs) # => ["same", "as", "tag", "list"]
296
- @user.save
297
- @user.tags_on(:customs) # => [<Tag name='same'>,...]
298
- @user.tag_counts_on(:customs)
299
- User.tagged_with("same", :on => :customs) # => [@user]
300
- ```
301
-
302
- ### Finding tags based on context
303
-
304
- You can find tags for a specific context by using the ```for_context``` scope:
305
-
306
- ```ruby
307
- ActsAsTaggableOn::Tag.for_context(:tags)
308
- ActsAsTaggableOn::Tag.for_context(:skills)
309
- ```
310
-
311
- ### Tag Parsers
312
-
313
- If you want to change how tags are parsed, you can define your own implementation:
314
-
315
- ```ruby
316
- class MyParser < ActsAsTaggableOn::GenericParser
317
- def parse
318
- ActsAsTaggableOn::TagList.new.tap do |tag_list|
319
- tag_list.add @tag_list.split('|')
320
- end
321
- end
322
- end
323
- ```
324
-
325
- Now you can use this parser, passing it as parameter:
326
-
327
- ```ruby
328
- @user = User.new(:name => "Bobby")
329
- @user.tag_list = "east, south"
330
- @user.tag_list.add("north|west", parser: MyParser)
331
- @user.tag_list # => ["north", "east", "south", "west"]
332
-
333
- # Or also:
334
- @user.tag_list.parser = MyParser
335
- @user.tag_list.add("north|west")
336
- @user.tag_list # => ["north", "east", "south", "west"]
337
- ```
338
-
339
- Or change it globally:
340
-
341
- ```ruby
342
- ActsAsTaggableOn.default_parser = MyParser
343
- @user = User.new(:name => "Bobby")
344
- @user.tag_list = "east|south"
345
- @user.tag_list # => ["east", "south"]
346
- ```
347
-
348
- ### Tag Ownership
349
-
350
- Tags can have owners:
351
-
352
- ```ruby
353
- class User < ActiveRecord::Base
354
- acts_as_tagger
355
- end
356
-
357
- class Photo < ActiveRecord::Base
358
- acts_as_taggable_on :locations
359
- end
360
-
361
- @some_user.tag(@some_photo, :with => "paris, normandy", :on => :locations)
362
- @some_user.owned_taggings
363
- @some_user.owned_tags
364
- Photo.tagged_with("paris", :on => :locations, :owned_by => @some_user)
365
- @some_photo.locations_from(@some_user) # => ["paris", "normandy"]
366
- @some_photo.owner_tags_on(@some_user, :locations) # => [#<ActsAsTaggableOn::Tag id: 1, name: "paris">...]
367
- @some_photo.owner_tags_on(nil, :locations) # => Ownerships equivalent to saying @some_photo.locations
368
- @some_user.tag(@some_photo, :with => "paris, normandy", :on => :locations, :skip_save => true) #won't save @some_photo object
369
- ```
370
-
371
- #### Working with Owned Tags
372
- Note that `tag_list` only returns tags whose taggings do not have an owner. Continuing from the above example:
373
- ```ruby
374
- @some_photo.tag_list # => []
375
- ```
376
- To retrieve all tags of an object (regardless of ownership) or if only one owner can tag the object, use `all_tags_list`.
377
-
378
- ##### Adding owned tags
379
- Note that **owned tags** are added all at once, in the form of ***comma separated tags*** in string.
380
- Also, when you try to add **owned tags** again, it simply overwrites the previous set of **owned tags**.
381
- So to append tags in previously existing **owned tags** list, go as follows:
382
- ```ruby
383
- def add_owned_tag
384
- @some_item = Item.find(params[:id])
385
- owned_tag_list = @some_item.all_tags_list - @some_item.tag_list
386
- owned_tag_list += [(params[:tag])]
387
- @tag_owner.tag(@some_item, :with => stringify(owned_tag_list), :on => :tags)
388
- @some_item.save
389
- end
390
-
391
- def stringify(tag_list)
392
- tag_list.inject('') { |memo, tag| memo += (tag + ',') }[0..-1]
393
- end
394
- ```
395
- ##### Removing owned tags
396
- Similarly as above, removing will be as follows:
397
- ```ruby
398
- def remove_owned_tag
399
- @some_item = Item.find(params[:id])
400
- owned_tag_list = @some_item.all_tags_list - @some_item.tag_list
401
- owned_tag_list -= [(params[:tag])]
402
- @tag_owner.tag(@some_item, :with => stringify(owned_tag_list), :on => :tags)
403
- @some_item.save
404
- end
405
- ```
406
-
407
- ### Tag Tenancy
408
-
409
- Tags support multi-tenancy. This is useful for applications where a Tag belongs to a scoped set of models:
410
-
411
- ```ruby
412
- class Account < ActiveRecord::Base
413
- has_many :photos
414
- end
415
-
416
- class User < ActiveRecord::Base
417
- belongs_to :account
418
- acts_as_taggable_on :tags
419
- acts_as_taggable_tenant :account_id
420
- end
421
-
422
- @user1.tag_list = ["foo", "bar"] # these taggings will automatically have the tenant saved
423
- @user2.tag_list = ["bar", "baz"]
424
-
425
- ActsAsTaggableOn::Tag.for_tenant(@user1.account.id) # returns Tag models for "foo" and "bar", but not "baz"
426
- ```
427
-
428
- ### Dirty objects
429
-
430
- ```ruby
431
- @bobby = User.find_by_name("Bobby")
432
- @bobby.skill_list # => ["jogging", "diving"]
433
-
434
- @bobby.skill_list_changed? #=> false
435
- @bobby.changes #=> {}
436
-
437
- @bobby.skill_list = "swimming"
438
- @bobby.changes.should == {"skill_list"=>["jogging, diving", ["swimming"]]}
439
- @bobby.skill_list_changed? #=> true
440
-
441
- @bobby.skill_list_change.should == ["jogging, diving", ["swimming"]]
442
- ```
443
-
444
- ### Tag cloud calculations
445
-
446
- To construct tag clouds, the frequency of each tag needs to be calculated.
447
- Because we specified `acts_as_taggable_on` on the `User` class, we can
448
- get a calculation of all the tag counts by using `User.tag_counts_on(:customs)`. But what if we wanted a tag count for
449
- a single user's posts? To achieve this we call tag_counts on the association:
450
-
451
- ```ruby
452
- User.find(:first).posts.tag_counts_on(:tags)
453
- ```
454
-
455
- A helper is included to assist with generating tag clouds.
456
-
457
- Here is an example that generates a tag cloud.
458
-
459
- Helper:
460
-
461
- ```ruby
462
- module PostsHelper
463
- include ActsAsTaggableOn::TagsHelper
464
- end
465
- ```
466
-
467
- Controller:
468
-
469
- ```ruby
470
- class PostController < ApplicationController
471
- def tag_cloud
472
- @tags = Post.tag_counts_on(:tags)
473
- end
474
- end
475
- ```
476
-
477
- View:
478
-
479
- ```erb
480
- <% tag_cloud(@tags, %w(css1 css2 css3 css4)) do |tag, css_class| %>
481
- <%= link_to tag.name, { :action => :tag, :id => tag.name }, :class => css_class %>
482
- <% end %>
483
- ```
484
-
485
- CSS:
486
-
487
- ```css
488
- .css1 { font-size: 1.0em; }
489
- .css2 { font-size: 1.2em; }
490
- .css3 { font-size: 1.4em; }
491
- .css4 { font-size: 1.6em; }
492
- ```
493
-
494
- ## Configuration
495
-
496
- If you would like to remove unused tag objects after removing taggings, add:
497
-
498
- ```ruby
499
- ActsAsTaggableOn.remove_unused_tags = true
500
- ```
501
-
502
- If you want force tags to be saved downcased:
503
-
504
- ```ruby
505
- ActsAsTaggableOn.force_lowercase = true
506
- ```
507
-
508
- If you want tags to be saved parametrized (you can redefine to_param as well):
509
-
510
- ```ruby
511
- ActsAsTaggableOn.force_parameterize = true
512
- ```
513
-
514
- If you would like tags to be case-sensitive and not use LIKE queries for creation:
515
-
516
- ```ruby
517
- ActsAsTaggableOn.strict_case_match = true
518
- ```
519
-
520
- If you would like to have an exact match covering special characters with MySql:
521
-
522
- ```ruby
523
- ActsAsTaggableOn.force_binary_collation = true
524
- ```
525
-
526
- If you would like to specify table names:
527
-
528
- ```ruby
529
- ActsAsTaggableOn.tags_table = 'aato_tags'
530
- ActsAsTaggableOn.taggings_table = 'aato_taggings'
531
- ```
532
-
533
- If you want to change the default delimiter (it defaults to ','). You can also pass in an array of delimiters such as ([',', '|']):
534
-
535
- ```ruby
536
- ActsAsTaggableOn.delimiter = ','
537
- ```
538
-
539
- *NOTE 1: SQLite by default can't upcase or downcase multibyte characters, resulting in unwanted behavior. Load the SQLite ICU extension for proper handle of such characters. [See docs](http://www.sqlite.org/src/artifact?ci=trunk&filename=ext/icu/README.txt)*
540
-
541
- *NOTE 2: the option `force_binary_collation` is strongest than `strict_case_match` and when
542
- set to true, the `strict_case_match` is ignored.
543
- To roughly apply the `force_binary_collation` behaviour with a version of the gem <= 3.4.4, execute the following commands in the MySql console:*
544
-
545
- ```shell
546
- USE my_wonderful_app_db;
547
- ALTER TABLE tags MODIFY name VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin;
548
- ```
549
-
550
- #### Upgrading
551
-
552
- see [UPGRADING](UPGRADING.md)
553
-
554
- ## Contributors
555
-
556
- We have a long list of valued contributors. [Check them all](https://github.com/mbleigh/acts-as-taggable-on/contributors)
557
-
558
- ## Compatibility
559
-
560
- Versions 2.x are compatible with Ruby 1.8.7+ and Rails 3.
561
-
562
- Versions 2.4.1 and up are compatible with Rails 4 too (thanks to arabonradar and cwoodcox).
563
-
564
- Versions >= 3.x are compatible with Ruby 1.9.3+ and Rails 3 and 4.
565
-
566
- Versions >= 4.x are compatible with Ruby 2.0.0+ and Rails 4 and 5.
567
-
568
- Versions >= 7.x are compatible with Ruby 2.3.7+ and Rails 5 and 6.
569
-
570
- Versions >= 8.x are compatible with Ruby 2.3.7+ and Rails 5 and 6.
571
-
572
- Versions >= 9.x are compatible with Ruby 2.5.0 and Rails 6 and 7.0.
573
-
574
- Versions >= 11.x are compatible with Ruby 3.1.0 and Rails 7.0 and 7.1.
575
-
576
- Versions >= 12.x are compatible with Ruby 3.2.0 and Rails 7.1, 7.2 and 8.0.
577
-
578
- For an up-to-date roadmap, see https://github.com/mbleigh/acts-as-taggable-on/milestones
579
-
580
- ## Testing
581
-
582
- Acts As Taggable On uses RSpec for its test coverage. Inside the gem
583
- directory, you can run the specs with:
584
-
585
- ```shell
586
- bundle
587
- rake spec
588
- ```
589
-
590
- You can run all the tests across all the Rails versions by running `rake appraise`.
591
- If you'd also like to [run the tests across all rubies and databases as configured for Github Actions, install and run `wwtd`](https://github.com/grosser/wwtd).
592
-
593
-
594
- ## License
595
-
596
- See [LICENSE](https://github.com/mbleigh/acts-as-taggable-on/blob/master/LICENSE.md)
data/Rakefile DELETED
@@ -1,21 +0,0 @@
1
- require 'rubygems'
2
- require 'bundler/setup'
3
-
4
- import "./lib/tasks/tags_collate_utf8.rake"
5
-
6
- desc 'Default: run specs'
7
- task default: :spec
8
-
9
- desc 'Copy sample spec database.yml over if not exists'
10
- task :copy_db_config do
11
- cp 'spec/internal/config/database.yml.sample', 'spec/internal/config/database.yml'
12
- end
13
-
14
- task spec: [:copy_db_config]
15
-
16
- require 'rspec/core/rake_task'
17
- RSpec::Core::RakeTask.new do |t|
18
- t.pattern = 'spec/**/*_spec.rb'
19
- end
20
-
21
- Bundler::GemHelper.install_tasks
@@ -1,32 +0,0 @@
1
- # coding: utf-8
2
-
3
- require_relative 'lib/acts-as-taggable-on/version'
4
-
5
- Gem::Specification.new do |gem|
6
- gem.name = 'acts-as-taggable-on'
7
- gem.version = ActsAsTaggableOn::VERSION
8
- gem.authors = ['Michael Bleigh', 'Joost Baaij']
9
- gem.email = %w(michael@intridea.com joost@spacebabies.nl)
10
- gem.description = %q{With ActsAsTaggableOn, you can tag a single model on several contexts, such as skills, interests, and awards. It also provides other advanced functionality.}
11
- gem.summary = 'Advanced tagging for Rails.'
12
- gem.homepage = 'https://github.com/mbleigh/acts-as-taggable-on'
13
- gem.license = 'MIT'
14
-
15
- gem.files = `git ls-files`.split($/)
16
- gem.test_files = gem.files.grep(%r{^spec/})
17
- gem.require_paths = ['lib']
18
- gem.required_ruby_version = '>= 3.2.0'
19
-
20
- if File.exist?('UPGRADING.md')
21
- gem.post_install_message = File.read('UPGRADING.md')
22
- end
23
-
24
- gem.add_runtime_dependency 'activerecord', '>= 7.1', '< 8.1'
25
- gem.add_runtime_dependency 'zeitwerk', '>= 2.4', '< 3.0'
26
-
27
- gem.add_development_dependency 'rspec-rails'
28
- gem.add_development_dependency 'rspec-its'
29
- gem.add_development_dependency 'rspec'
30
- gem.add_development_dependency 'barrier'
31
- gem.add_development_dependency 'database_cleaner'
32
- end
data/docker-compose.yml DELETED
@@ -1,15 +0,0 @@
1
- version: '3.9'
2
- services:
3
- postgres:
4
- image: postgres:10
5
- environment:
6
- POSTGRES_USER: postgres
7
- POSTGRES_DB: acts_as_taggable_on
8
- POSTGRES_PASSWORD: postgres
9
- ports: ['5432:5432']
10
- mysql:
11
- image: mysql:8
12
- environment:
13
- MYSQL_ALLOW_EMPTY_PASSWORD: true
14
- MYSQL_DATABASE: acts_as_taggable_on
15
- ports: ['3306:3306']
@@ -1,18 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "activerecord", "~> 7.1.0"
6
- gem "pg"
7
- gem "sqlite3", "~> 1.4"
8
- gem "mysql2", "~> 0.5"
9
-
10
- group :local_development do
11
- gem "guard"
12
- gem "guard-rspec"
13
- gem "appraisal"
14
- gem "rake"
15
- gem "byebug", platforms: [:mri]
16
- end
17
-
18
- gemspec path: "../"
@@ -1,18 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "activerecord", "~> 7.2.0"
6
- gem "pg"
7
- gem "sqlite3", "~> 2.1"
8
- gem "mysql2", "~> 0.5"
9
-
10
- group :local_development do
11
- gem "guard"
12
- gem "guard-rspec"
13
- gem "appraisal"
14
- gem "rake"
15
- gem "byebug", platforms: [:mri]
16
- end
17
-
18
- gemspec path: "../"