update specs; add new specs to test for reported bug related to AND query in referenced table
This commit is contained in:
@@ -82,6 +82,21 @@ class DynamicModelWithTagValues < ActiveRecord::Base
|
||||
has_many :tags, as: :taggable
|
||||
end
|
||||
|
||||
class DynamicModelWithTagAndCategories < ActiveRecord::Base
|
||||
self.table_name = :dynamic_models
|
||||
include PgSearchable
|
||||
pg_search fields: %i[dynamic_models.id dynamic_models.name dynamic_models.value], fields_mappings: {tag: 'tags.value', category: 'categories.name'}, joins: [:tags, :categories]
|
||||
has_many :tags, as: :taggable
|
||||
has_many :categories, as: :categoriable
|
||||
end
|
||||
|
||||
class DynamicModelWithTagValuesAndCustomAttribute < ActiveRecord::Base
|
||||
self.table_name = :dynamic_models
|
||||
include PgSearchable
|
||||
pg_search fields: %i[dynamic_models.id dynamic_models.name dynamic_models.value], fields_mappings: {tag: 'tags.value', custom: 'tags.custom_attribute'}, joins: [:tags]
|
||||
has_many :tags, as: :taggable
|
||||
end
|
||||
|
||||
class DynamicModelWithCategory < ActiveRecord::Base
|
||||
self.table_name = :dynamic_models
|
||||
include PgSearchable
|
||||
@@ -112,4 +127,5 @@ end
|
||||
|
||||
class Category < ActiveRecord::Base
|
||||
has_many :tags
|
||||
belongs_to :categoriable, polymorphic: true
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user