From 8112610aad62a4e87b82b062ebe014f41a5f0208 Mon Sep 17 00:00:00 2001 From: Chris Oliver Date: Mon, 30 Sep 2024 14:21:44 -0500 Subject: [PATCH] Use stable sort when prioritizing app assets (#209) --- lib/propshaft/railtie.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/propshaft/railtie.rb b/lib/propshaft/railtie.rb index 101a286..fc79a4f 100644 --- a/lib/propshaft/railtie.rb +++ b/lib/propshaft/railtie.rb @@ -33,7 +33,7 @@ class Railtie < ::Rails::Railtie config.after_initialize do |app| # Prioritize assets from within the application over assets of the same path from engines/gems. - config.assets.paths.sort_by! { |path| path.to_s.start_with?(Rails.root.to_s) ? 0 : 1 } + config.assets.paths.sort_by!.with_index { |path, i| [path.to_s.start_with?(Rails.root.to_s) ? 0 : 1, i] } config.assets.relative_url_root ||= app.config.relative_url_root config.assets.output_path ||=