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.

Revert change.

Matthew Kennedyecc366da129e
diff --git a/core/app/models/spree/menu.rb b/core/app/models/spree/menu.rb
index c121fec30d..6df34a1e3e 100644
--- a/core/app/models/spree/menu.rb
+++ b/core/app/models/spree/menu.rb
@@ -22,6 +22,8 @@ module Spree
has_one :root, -> { where(parent_id: nil) }, class_name: 'Spree::MenuItem', dependent: :destroy
+ default_scope { order(created_at: :asc) }
+
scope :by_store, ->(store) { where(store: store) }
scope :by_locale, ->(locale) { where(locale: locale) }
@@ -31,7 +33,7 @@ module Spree
define_singleton_method("for_#{location_name}") do |locale, store|
menu = find_by(location: location_name, locale: locale.to_s) ||
store.default_menu(location_name) ||
- find_by(location: location_name, created_at: :asc)
+ find_by(location: location_name)
if menu.present?
menu.root
end