mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Set up variant tags as searchable
This commit is contained in:
@@ -21,7 +21,7 @@ module Spree
|
||||
acts_as_taggable
|
||||
|
||||
searchable_attributes :sku, :display_as, :display_name, :primary_taxon_id, :supplier_id
|
||||
searchable_associations :product, :default_price, :primary_taxon, :supplier
|
||||
searchable_associations :product, :default_price, :primary_taxon, :supplier, :tags
|
||||
searchable_scopes :active, :deleted
|
||||
|
||||
NAME_FIELDS = ["display_name", "display_as", "weight", "unit_value", "unit_description"].freeze
|
||||
|
||||
@@ -1 +1,19 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
ActsAsTaggableOn.force_lowercase = true
|
||||
|
||||
# Monkey patch suggested as workaround to the allowlisted issue
|
||||
# This may be removed when an official fix is included in Ransack
|
||||
module ActsAsTaggableOn
|
||||
class Tag
|
||||
class << self
|
||||
def ransackable_associations(_auth_object = nil)
|
||||
["taggings"]
|
||||
end
|
||||
|
||||
def ransackable_attributes(_auth_object = nil)
|
||||
["name"]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user