]> git.openstreetmap.org Git - rails.git/blobdiff - app/helpers/asset_helper.rb
Use file_exists to provide File.exists? for ruby 3.2
[rails.git] / app / helpers / asset_helper.rb
index 5b07407353c3e8a9276a9635d54e01b74f55ab67..40782fbcfad5676e6c59eb900610aef25d27ab22 100644 (file)
@@ -1,11 +1,7 @@
 module AssetHelper
   def assets(directory)
 module AssetHelper
   def assets(directory)
-    assets = {}
-
-    Rails.application.assets.index.each_logical_path("#{directory}/*") do |path|
-      assets[path.sub(%r{^#{directory}/}, "")] = asset_path(path)
+    Rails.application.assets_manifest.assets.keys.each_with_object({}) do |asset, assets|
+      assets[asset] = asset_path(asset) if asset.start_with?("#{directory}/")
     end
     end
-
-    assets
   end
 end
   end
 end