Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Move MultiSearchable alias to separate file for Zeitwerk (#14254)

Damian Legawieca3b1123f1265
diff --git a/spree/core/app/models/concerns/spree/multi_searchable.rb b/spree/core/app/models/concerns/spree/multi_searchable.rb
new file mode 100644
index 0000000000..8d8355857b
--- /dev/null
+++ b/spree/core/app/models/concerns/spree/multi_searchable.rb
@@ -0,0 +1,10 @@
+module Spree
+ # Constant alias for Spree::Searchable — remove in Spree 6.0.
+ #
+ # Lets legacy code and extensions reference the concern by its former name
+ # after the Searchable rename. The concern itself lives in Spree::Searchable;
+ # keeping the alias in its own file lets Zeitwerk manage (and reload) it,
+ # avoiding the "already initialized constant" warning that a second constant
+ # defined inside searchable.rb would raise.
+ MultiSearchable = Searchable
+end
diff --git a/spree/core/app/models/concerns/spree/searchable.rb b/spree/core/app/models/concerns/spree/searchable.rb
index 6401ca0137..d34c0d7781 100644
--- a/spree/core/app/models/concerns/spree/searchable.rb
+++ b/spree/core/app/models/concerns/spree/searchable.rb
@@ -31,7 +31,4 @@ module Spree
def self.multi_search_condition(model_class, attribute, query) = search_condition(model_class, attribute, query)
end
end
-
- # Backward compatibility alias — remove in Spree 6.0
- MultiSearchable = Searchable
end