[openstreetmap/openstreetmap-website] Make AssetHelper work without precompiled assets (PR #6856)

Tom Hughes notifications at github.com
Wed Mar 4 20:49:49 UTC 2026


@tomhughes commented on this pull request.



> @@ -2,8 +2,20 @@
 
 module AssetHelper
   def assets(directory)
-    Rails.application.assets_manifest.assets.keys.each_with_object({}) do |asset, assets|
-      assets[asset] = asset_path(asset) if asset.start_with?("#{directory}/")
+    if (manifest = Rails.application.assets_manifest.assets) && !manifest.empty?
+      # With precompiled assets
+      manifest.keys.each_with_object({}) do |asset, assets|
+        assets[asset] = asset_path(asset) if asset.start_with?("#{directory}/")
+      end
+    elsif (env = Rails.application.assets) && env.present?

It does appear to be set in production but I guess it doesn't really matter if we test it.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/6856#discussion_r2886028755
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/6856/review/3891933808 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20260304/fc35c63e/attachment.htm>


More information about the rails-dev mailing list