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.

Set :asc only on the fallback call.

Matthew Kennedy3d55a1d7e631
diff --git a/core/app/models/spree/menu.rb b/core/app/models/spree/menu.rb
index 6df34a1e3e..c121fec30d 100644
--- a/core/app/models/spree/menu.rb
+++ b/core/app/models/spree/menu.rb
@@ -22,8 +22,6 @@ 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) }
@@ -33,7 +31,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)
+ find_by(location: location_name, created_at: :asc)
if menu.present?
menu.root
end