From eada9eb5a6bb416abbad81b28b668387cf66f78d Mon Sep 17 00:00:00 2001 From: Abdelkader Boudih Date: Sat, 16 Jun 2018 15:09:55 +0000 Subject: [PATCH 1/3] Use Utils to escape tags --- .../taggable/tagged_with_query/query_base.rb | 2 +- lib/acts_as_taggable_on/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/acts_as_taggable_on/taggable/tagged_with_query/query_base.rb b/lib/acts_as_taggable_on/taggable/tagged_with_query/query_base.rb index 56481e74e..b556d70f0 100644 --- a/lib/acts_as_taggable_on/taggable/tagged_with_query/query_base.rb +++ b/lib/acts_as_taggable_on/taggable/tagged_with_query/query_base.rb @@ -48,7 +48,7 @@ def tags_match_type def escaped_tag(tag) tag = tag.downcase unless ActsAsTaggableOn.strict_case_match - tag.gsub(/[!%_]/) { |x| '!' + x } + ActsAsTaggableOn::Utils.escape_like(tag) end def adjust_taggings_alias(taggings_alias) diff --git a/lib/acts_as_taggable_on/version.rb b/lib/acts_as_taggable_on/version.rb index e311f9c59..49f8b1466 100644 --- a/lib/acts_as_taggable_on/version.rb +++ b/lib/acts_as_taggable_on/version.rb @@ -1,4 +1,4 @@ module ActsAsTaggableOn - VERSION = '5.0.0' + VERSION = '6.0.0' end From 5f5eae366f50b50d904e8debe5ef427689b8d165 Mon Sep 17 00:00:00 2001 From: Calvert Date: Sat, 16 Jun 2018 15:24:11 +0000 Subject: [PATCH 2/3] Fix UUID as primary key --- lib/acts_as_taggable_on/taggable/related.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/acts_as_taggable_on/taggable/related.rb b/lib/acts_as_taggable_on/taggable/related.rb index 8fb02d35a..7a9755108 100644 --- a/lib/acts_as_taggable_on/taggable/related.rb +++ b/lib/acts_as_taggable_on/taggable/related.rb @@ -49,7 +49,7 @@ def related_tags_for(context, klass, options = {}) private def exclude_self(klass, id) - "#{klass.table_name}.#{klass.primary_key} != #{id} AND" if [self.class.base_class, self.class].include? klass + "#{klass.arel_table[klass.primary_key].not_eq(id).to_sql} AND" if [self.class.base_class, self.class].include? klass end def group_columns(klass) From a790d4b6b4bc8a099ae58b4a6ae1502fcbe5e6fa Mon Sep 17 00:00:00 2001 From: Abdelkader Boudih Date: Sun, 17 Jun 2018 00:59:11 +0000 Subject: [PATCH 3/3] Dont install unused adapters --- Gemfile | 2 +- acts-as-taggable-on.gemspec | 4 ---- gemfiles/activerecord_5.0.gemfile | 8 ++++++++ gemfiles/activerecord_5.1.gemfile | 8 ++++++++ gemfiles/activerecord_5.2.gemfile | 8 ++++++++ 5 files changed, 25 insertions(+), 5 deletions(-) diff --git a/Gemfile b/Gemfile index d7c921c74..e2eff4df8 100644 --- a/Gemfile +++ b/Gemfile @@ -7,5 +7,5 @@ group :local_development do gem 'guard-rspec' gem 'appraisal' gem 'rake' - gem 'byebug' , platforms: [:mri_21, :mri_22, :mri_23] + gem 'byebug', platforms: [:mri] end diff --git a/acts-as-taggable-on.gemspec b/acts-as-taggable-on.gemspec index 534ab499c..8258c30f1 100644 --- a/acts-as-taggable-on.gemspec +++ b/acts-as-taggable-on.gemspec @@ -24,10 +24,6 @@ Gem::Specification.new do |gem| gem.add_runtime_dependency 'activerecord', ['~> 5.0'] - gem.add_development_dependency 'sqlite3' - gem.add_development_dependency 'mysql2', '~> 0.3' - gem.add_development_dependency 'pg' - gem.add_development_dependency 'rspec-rails' gem.add_development_dependency 'rspec-its' gem.add_development_dependency 'rspec' diff --git a/gemfiles/activerecord_5.0.gemfile b/gemfiles/activerecord_5.0.gemfile index ee23028fd..e48906999 100644 --- a/gemfiles/activerecord_5.0.gemfile +++ b/gemfiles/activerecord_5.0.gemfile @@ -3,6 +3,14 @@ source "https://rubygems.org" gem "activerecord", "~> 5.0.3" +case ENV["DB"] +when "postgresql" + gem 'pg' +when "mysql" + gem 'mysql2', '~> 0.3' +else + gem 'sqlite3' +end group :local_development do gem "guard" diff --git a/gemfiles/activerecord_5.1.gemfile b/gemfiles/activerecord_5.1.gemfile index ea71e58bc..ca8c1920c 100644 --- a/gemfiles/activerecord_5.1.gemfile +++ b/gemfiles/activerecord_5.1.gemfile @@ -3,6 +3,14 @@ source "https://rubygems.org" gem "activerecord", "~> 5.1.1" +case ENV["DB"] +when "postgresql" + gem 'pg' +when "mysql" + gem 'mysql2', '~> 0.3' +else + gem 'sqlite3' +end group :local_development do gem "guard" diff --git a/gemfiles/activerecord_5.2.gemfile b/gemfiles/activerecord_5.2.gemfile index 6b566da46..fe6525fdd 100644 --- a/gemfiles/activerecord_5.2.gemfile +++ b/gemfiles/activerecord_5.2.gemfile @@ -3,6 +3,14 @@ source "https://rubygems.org" gem "activerecord", "~> 5.2.0" +case ENV["DB"] +when "postgresql" + gem 'pg' +when "mysql" + gem 'mysql2', '~> 0.3' +else + gem 'sqlite3' +end group :local_development do gem "guard"