admin管理员组

文章数量:1389754

Before Propshaft you would use Rails.application.assets.find_asset(path).present?.

But how do you check if an asset exists using the new asset library for Rails 8?

Before Propshaft you would use Rails.application.assets.find_asset(path).present?.

But how do you check if an asset exists using the new asset library for Rails 8?

Share Improve this question edited Mar 16 at 18:07 Timothy Alexis Vass asked Mar 15 at 18:07 Timothy Alexis VassTimothy Alexis Vass 2,7252 gold badges13 silver badges32 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

With Propshaft, this is handled by the resolver.

Rails.application.assets.resolver.resolve(logical_path).present?

本文标签: Rails 8 Asset Pipeline How do I determine if an asset exists with PropshaftStack Overflow