make_taggable 0.6.3 → 0.6.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
  SHA256:
3
- metadata.gz: 75e4c687d801738a1e36a15accd18686dd13ed883941e609bbfae23f98eaaae9
4
- data.tar.gz: 103971ae8293cbfaaf351c3193022332eb024581c02ca89ea1d95d8bb8a4f154
3
+ metadata.gz: fc110297a0bf19db2784546646da17f6ae73dc9f359383ae06e1d3502544474a
4
+ data.tar.gz: efa71fe953279fd9a1e16b064faff9f3eb24551759b9657b6db112b11e32f241
5
5
  SHA512:
6
- metadata.gz: eaf416b1f1490f92bf44c1992bbf68519a44ef55068f4183c73fbb19f729d4864e89124a4454e65afe9e164e16c9339f3659ae4d6ed95821ddfd15371649de3d
7
- data.tar.gz: 46b07f4697367374b69458d011b6770883ae36b29c519c66dedd1aa070ca22cb08defecc8d80da29d79860a82368592898ba3be5a77d7b33e308f5a4c2d630f3
6
+ metadata.gz: ee09cc7eb170007245f4d7e4c072699cdeadca15700deb5d356bfe1724d52d04bb0ee6e095845a2d05b9889dfd44e5a384de87cd301c5fa287f010ed901fa6cc
7
+ data.tar.gz: 5f443267e9ee6db3666ebc03dab51b89f41291ba5122cb040a29c3f73f7fdcd0b99fff04d772bb31537bf7760bdf2b0919fcbc371327acf8ec0a1a0e8f8e9ac9
data/README.md CHANGED
@@ -37,6 +37,21 @@ Review the generated migrations then migrate :
37
37
  rails db:migrate
38
38
  ```
39
39
 
40
+ #### For MySql users
41
+ 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:
42
+
43
+ ```ruby
44
+ MakeTaggable.force_binary_collation = true
45
+ ```
46
+
47
+ Or by running this rake task:
48
+
49
+ ```shell
50
+ rails make_taggable_on_engine:tag_names:collate_bin
51
+ ```
52
+
53
+ See the Configuration section for more details.
54
+
40
55
  ## Usage
41
56
 
42
57
  Setup
data/Rakefile CHANGED
@@ -1,7 +1,10 @@
1
1
  require "bundler/gem_tasks"
2
2
 
3
+ import "./lib/tasks/tags_collate_utf8.rake"
4
+
3
5
  APP_RAKEFILE = File.expand_path("spec/dummy/Rakefile", __dir__)
4
6
 
5
7
  require "rspec/core/rake_task"
6
8
  RSpec::Core::RakeTask.new(:spec)
7
9
  task default: :spec
10
+
@@ -0,0 +1,5 @@
1
+ When upgrading run the migrations generator
2
+
3
+ rake acts_as_taggable_on_engine:install:migrations
4
+
5
+ This will create any new migrations and skip existing ones
@@ -0,0 +1,7 @@
1
+ class ChangeTagNameCollationMysql < ActiveRecord::Migration[5.2]
2
+ def change
3
+ if MakeTaggable::Utils.using_mysql?
4
+ execute("ALTER TABLE #{MakeTaggable.tags_table} MODIFY name varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;")
5
+ end
6
+ end
7
+ end
@@ -29,9 +29,9 @@ module MakeTaggable::Taggable::TaggedWithQuery
29
29
  matches_attribute = matches_attribute.lower unless MakeTaggable.strict_case_match
30
30
 
31
31
  if options[:wild].present?
32
- matches_attribute.matches("%#{escaped_tag(tag)}%", "!")
32
+ matches_attribute.matches("%#{escaped_tag(tag)}%", "!", MakeTaggable.strict_case_match)
33
33
  else
34
- matches_attribute.matches(escaped_tag(tag), "!")
34
+ matches_attribute.matches(escaped_tag(tag), "!", MakeTaggable.strict_case_match)
35
35
  end
36
36
  end
37
37
 
@@ -40,9 +40,9 @@ module MakeTaggable::Taggable::TaggedWithQuery
40
40
  matches_attribute = matches_attribute.lower unless MakeTaggable.strict_case_match
41
41
 
42
42
  if options[:wild].present?
43
- matches_attribute.matches_any(tag_list.map { |tag| "%#{escaped_tag(tag)}%" }, "!")
43
+ matches_attribute.matches_any(tag_list.map { |tag| "%#{escaped_tag(tag)}%" }, "!", MakeTaggable.strict_case_match)
44
44
  else
45
- matches_attribute.matches_any(tag_list.map { |tag| escaped_tag(tag).to_s }, "!")
45
+ matches_attribute.matches_any(tag_list.map { |tag| escaped_tag(tag).to_s }, "!", MakeTaggable.strict_case_match)
46
46
  end
47
47
  end
48
48
 
@@ -18,7 +18,7 @@ module MakeTaggable
18
18
  owned_taggings_scope = opts.delete(:scope)
19
19
 
20
20
  has_many :owned_taggings, owned_taggings_scope,
21
- opts.merge(
21
+ **opts.merge(
22
22
  as: :tagger,
23
23
  class_name: "::MakeTaggable::Tagging",
24
24
  dependent: :destroy
@@ -6,7 +6,7 @@ module MakeTaggable
6
6
  belongs_to :tag, class_name: "::MakeTaggable::Tag", counter_cache: MakeTaggable.tags_counter
7
7
  belongs_to :taggable, polymorphic: true
8
8
 
9
- belongs_to :tagger, {polymorphic: true, optional: true}
9
+ belongs_to :tagger, polymorphic: true, optional: true
10
10
 
11
11
  scope :owned_by, ->(owner) { where(tagger: owner) }
12
12
  scope :not_owned, -> { where(tagger_id: nil, tagger_type: nil) }
@@ -1,4 +1,4 @@
1
1
  # Acts As Taggable With Updates
2
2
  module MakeTaggable
3
- VERSION = "0.6.3"
3
+ VERSION = "0.6.4"
4
4
  end
@@ -7,11 +7,15 @@ Gem::Specification.new do |spec|
7
7
  spec.version = MakeTaggable::VERSION
8
8
  spec.authors = ["Matthew Kennedy", "Michael Bleigh", "Joost Baaij"]
9
9
  spec.email = %w[m.kennedy@me.com michael@intridea.com joost@spacebabies.nl]
10
- spec.description = "MakeTaggable is a fork of acts-as-taggable-on v6.5 with code updates and a new set of migrations."
10
+ spec.description = "A fork of acts-as-taggable-on v6.5 with code updates and a new set of migrations."
11
11
  spec.summary = "Advanced Tagging For Rails"
12
12
  spec.homepage = "https://github.com/MatthewKennedy/make_taggable"
13
13
  spec.license = "MIT"
14
14
 
15
+ if File.exist?('UPGRADING.md')
16
+ spec.post_install_message = File.read('UPGRADING.md')
17
+ end
18
+
15
19
  spec.files = `git ls-files`.split($/)
16
20
  spec.test_files = spec.files.grep(%r{^spec/})
17
21
  spec.require_paths = ["lib"]
@@ -0,0 +1,8 @@
1
+ # This migration comes from make_taggable_engine (originally 3)
2
+ class ChangeTagNameCollationMysql < ActiveRecord::Migration[5.2]
3
+ def change
4
+ if MakeTaggable::Utils.using_mysql?
5
+ execute("ALTER TABLE #{MakeTaggable.tags_table} MODIFY name varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;")
6
+ end
7
+ end
8
+ end
@@ -1,4 +1,4 @@
1
- # This migration comes from make_taggable_engine (originally 3)
1
+ # This migration comes from make_taggable_engine (originally 4)
2
2
  class AddIndexToTags < ActiveRecord::Migration[5.2]
3
3
  def change
4
4
  add_index MakeTaggable.tags_table, :name, unique: true
@@ -1,4 +1,4 @@
1
- # This migration comes from make_taggable_engine (originally 4)
1
+ # This migration comes from make_taggable_engine (originally 5)
2
2
  class AddIndexToTaggings < ActiveRecord::Migration[5.2]
3
3
  def change
4
4
  add_index MakeTaggable.taggings_table, :taggable_id
@@ -10,7 +10,7 @@
10
10
  #
11
11
  # It's strongly recommended that you check this file into your version control system.
12
12
 
13
- ActiveRecord::Schema.define(version: 2020_11_19_222432) do
13
+ ActiveRecord::Schema.define(version: 2020_11_21_222011) do
14
14
 
15
15
  create_table "cache_methods_injected_models", force: :cascade do |t|
16
16
  t.string "cached_tag_list"
@@ -474,7 +474,7 @@ describe "Taggable" do
474
474
 
475
475
  expect(TaggableModel.tagged_with(%w[bob tricia], wild: true, any: true).to_a.sort_by { |o| o.id }).to eq([bob, frank, steve])
476
476
  expect(TaggableModel.tagged_with(%w[bob tricia], wild: true, exclude: true).to_a).to eq([jim])
477
- expect(TaggableModel.tagged_with("ji", wild: true, any: true).to_a =~ [frank, jim])
477
+ expect(TaggableModel.tagged_with('ji', wild: true, any: true).to_a).to match_array([frank, jim])
478
478
  end
479
479
  end
480
480
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: make_taggable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.3
4
+ version: 0.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Kennedy
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2020-11-20 00:00:00.000000000 Z
13
+ date: 2020-11-21 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
@@ -96,8 +96,8 @@ dependencies:
96
96
  - - ">="
97
97
  - !ruby/object:Gem::Version
98
98
  version: '0'
99
- description: MakeTaggable is a fork of acts-as-taggable-on v6.5 with code updates
100
- and a new set of migrations.
99
+ description: A fork of acts-as-taggable-on v6.5 with code updates and a new set of
100
+ migrations.
101
101
  email:
102
102
  - m.kennedy@me.com
103
103
  - michael@intridea.com
@@ -121,12 +121,14 @@ files:
121
121
  - LICENSE.txt
122
122
  - README.md
123
123
  - Rakefile
124
+ - UPGRADING.md
124
125
  - bin/console
125
126
  - bin/setup
126
127
  - db/migrate/1_create_make_taggable_tags.rb
127
128
  - db/migrate/2_create_make_taggable_taggings.rb
128
- - db/migrate/3_add_index_to_tags.rb
129
- - db/migrate/4_add_index_to_taggings.rb
129
+ - db/migrate/3_change_tag_name_collation_mysql.rb
130
+ - db/migrate/4_add_index_to_tags.rb
131
+ - db/migrate/5_add_index_to_taggings.rb
130
132
  - gemfiles/rails_5.gemfile
131
133
  - gemfiles/rails_6.gemfile
132
134
  - gemfiles/rails_master.gemfile
@@ -222,10 +224,11 @@ files:
222
224
  - spec/dummy/db/migrate/20201119221530_create_cache_methods_injected_models.rb
223
225
  - spec/dummy/db/migrate/20201119221629_create_other_cached_with_array_models.rb
224
226
  - spec/dummy/db/migrate/20201119221746_create_taggable_model_with_jsons.rb
225
- - spec/dummy/db/migrate/20201119222429_create_make_taggable_tags.make_taggable_engine.rb
226
- - spec/dummy/db/migrate/20201119222430_create_make_taggable_taggings.make_taggable_engine.rb
227
- - spec/dummy/db/migrate/20201119222431_add_index_to_tags.make_taggable_engine.rb
228
- - spec/dummy/db/migrate/20201119222432_add_index_to_taggings.make_taggable_engine.rb
227
+ - spec/dummy/db/migrate/20201121222007_create_make_taggable_tags.make_taggable_engine.rb
228
+ - spec/dummy/db/migrate/20201121222008_create_make_taggable_taggings.make_taggable_engine.rb
229
+ - spec/dummy/db/migrate/20201121222009_change_tag_name_collation_mysql.make_taggable_engine.rb
230
+ - spec/dummy/db/migrate/20201121222010_add_index_to_tags.make_taggable_engine.rb
231
+ - spec/dummy/db/migrate/20201121222011_add_index_to_taggings.make_taggable_engine.rb
229
232
  - spec/dummy/db/schema.rb
230
233
  - spec/dummy/db/seeds.rb
231
234
  - spec/dummy/lib/tasks/.keep
@@ -264,7 +267,12 @@ homepage: https://github.com/MatthewKennedy/make_taggable
264
267
  licenses:
265
268
  - MIT
266
269
  metadata: {}
267
- post_install_message:
270
+ post_install_message: |
271
+ When upgrading run the migrations generator
272
+
273
+ rake acts_as_taggable_on_engine:install:migrations
274
+
275
+ This will create any new migrations and skip existing ones
268
276
  rdoc_options: []
269
277
  require_paths:
270
278
  - lib
@@ -351,10 +359,11 @@ test_files:
351
359
  - spec/dummy/db/migrate/20201119221530_create_cache_methods_injected_models.rb
352
360
  - spec/dummy/db/migrate/20201119221629_create_other_cached_with_array_models.rb
353
361
  - spec/dummy/db/migrate/20201119221746_create_taggable_model_with_jsons.rb
354
- - spec/dummy/db/migrate/20201119222429_create_make_taggable_tags.make_taggable_engine.rb
355
- - spec/dummy/db/migrate/20201119222430_create_make_taggable_taggings.make_taggable_engine.rb
356
- - spec/dummy/db/migrate/20201119222431_add_index_to_tags.make_taggable_engine.rb
357
- - spec/dummy/db/migrate/20201119222432_add_index_to_taggings.make_taggable_engine.rb
362
+ - spec/dummy/db/migrate/20201121222007_create_make_taggable_tags.make_taggable_engine.rb
363
+ - spec/dummy/db/migrate/20201121222008_create_make_taggable_taggings.make_taggable_engine.rb
364
+ - spec/dummy/db/migrate/20201121222009_change_tag_name_collation_mysql.make_taggable_engine.rb
365
+ - spec/dummy/db/migrate/20201121222010_add_index_to_tags.make_taggable_engine.rb
366
+ - spec/dummy/db/migrate/20201121222011_add_index_to_taggings.make_taggable_engine.rb
358
367
  - spec/dummy/db/schema.rb
359
368
  - spec/dummy/db/seeds.rb
360
369
  - spec/dummy/lib/tasks/.keep