From 9318c4f1e9367626196fe4866b3a6e9d77b95bc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Fri, 29 May 2020 14:26:53 +0200 Subject: [PATCH] Bump pg_search from 2.0.1 to 2.3.0 Using pg_search 2.0.1 with Rails 5.2 results in deprecation warnings: DEPRECATION WARNING: Dangerous query method (method whose arguments used as raw SQL) called with non-attribute argument(s): "pg_search_978c2f8941354cf552831b.rank DESC, \"tags\".\"id\" ASC". Non-attribute arguments will be disallowed in Rails 6.0. This method should not be called with user-provided values, such as request parameters or model attributes. Known-safe values can be passed by wrapping them in Arel.sql(). We're not upgrading to the latest pg_search because it only supports ActiveRecord >= 5.2. --- Gemfile | 2 +- Gemfile.lock | 5 ++--- app/models/concerns/searchable.rb | 2 +- config/initializers/acts_as_taggable_on.rb | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Gemfile b/Gemfile index 6b90aebc9..7fab9992d 100644 --- a/Gemfile +++ b/Gemfile @@ -40,7 +40,7 @@ gem "omniauth-twitter", "~> 1.4.0" gem "paperclip", "~> 5.2.1" gem "paranoia", "~> 2.4.2" gem "pg", "~> 0.21.0" -gem "pg_search", "~> 2.0.1" +gem "pg_search", "~> 2.3.0" gem "puma", "~> 4.3.5" gem "recipient_interceptor", "~> 0.2.0" gem "redcarpet", "~> 3.4.0" diff --git a/Gemfile.lock b/Gemfile.lock index ee8adbee6..20329b10a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -396,10 +396,9 @@ GEM parser (2.7.1.3) ast (~> 2.4.0) pg (0.21.0) - pg_search (2.0.1) + pg_search (2.3.0) activerecord (>= 4.2) activesupport (>= 4.2) - arel (>= 6) public_suffix (4.0.1) puma (4.3.5) nio4r (~> 2.0) @@ -665,7 +664,7 @@ DEPENDENCIES paperclip (~> 5.2.1) paranoia (~> 2.4.2) pg (~> 0.21.0) - pg_search (~> 2.0.1) + pg_search (~> 2.3.0) puma (~> 4.3.5) rails (= 5.1.7) rails-assets-leaflet! diff --git a/app/models/concerns/searchable.rb b/app/models/concerns/searchable.rb index f6e5a8c21..3958288a6 100644 --- a/app/models/concerns/searchable.rb +++ b/app/models/concerns/searchable.rb @@ -2,7 +2,7 @@ module Searchable extend ActiveSupport::Concern included do - include PgSearch + include PgSearch::Model include SearchCache pg_search_scope :pg_search, ->(query) do diff --git a/config/initializers/acts_as_taggable_on.rb b/config/initializers/acts_as_taggable_on.rb index 940f411b2..16d3d6845 100644 --- a/config/initializers/acts_as_taggable_on.rb +++ b/config/initializers/acts_as_taggable_on.rb @@ -40,7 +40,7 @@ module ActsAsTaggableOn Tagging.public_for_api.distinct.pluck("taggings.tag_id")) end - include PgSearch + include PgSearch::Model pg_search_scope :pg_search, against: :name, using: {