From c7ae81a533deac07064bc5a5e41cfe14e35fcc7e Mon Sep 17 00:00:00 2001 From: Bilal Catic Date: Tue, 11 Feb 2020 13:34:49 +0100 Subject: [PATCH] update spec models --- spec/support/models.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/spec/support/models.rb b/spec/support/models.rb index a5208c7..58d632c 100755 --- a/spec/support/models.rb +++ b/spec/support/models.rb @@ -5,6 +5,12 @@ class VectorModel < ActiveRecord::Base pg_search fields: %i[vector_models.id vector_models.name vector_models.value], cache: :search_cache end +class VectorModelWithMappings < ActiveRecord::Base + self.table_name = :vector_models + include PgSearchable + pg_search fields: %i[vector_models.id vector_models.name vector_models.value], fields_mappings: {device_id: "vector_models.id"}, cache: :search_cache +end + class VectorModelWithoutCallback < ActiveRecord::Base self.table_name = :vector_models include PgSearchable @@ -35,12 +41,6 @@ class SimpleVectorModel < ActiveRecord::Base pg_search fields: %i[vector_models.id vector_models.name vector_models.value], cache: :search_cache, language: :simple end -class SimplePlayerModel < ActiveRecord::Base - self.table_name = :players - include PgSearchable - pg_search fields: %i[device_id name value tags], cache: :search_cache, language: :simple -end - class VectorWithoutWildcardModel < ActiveRecord::Base self.table_name = :vector_models include PgSearchable @@ -72,7 +72,7 @@ end class DynamicModelWithTagValues < ActiveRecord::Base self.table_name = :dynamic_models include PgSearchable - pg_search fields: %i[dynamic_models.id dynamic_models.name dynamic_models.value tags.value], joins: [:tags] + pg_search fields: %i[dynamic_models.id dynamic_models.name dynamic_models.value], fields_mappings: {tag: 'tags.value'}, joins: [:tags] has_many :tags, as: :taggable end