In Rails, why is asset management important for web applications?
Think about how many files a webpage loads and how asset management can help.
Asset management in Rails bundles and compresses CSS, JavaScript, and images to reduce load times and server requests, improving user experience.
After running rails assets:precompile, what is the expected behavior when the app serves assets?
Think about how precompilation helps with caching and performance.
Precompiling assets creates fingerprinted files that browsers can cache effectively, improving load speed and reducing server work.
After deploying a Rails app, users report that CSS changes are not visible. What is the most likely cause?
Consider how browsers cache assets and what precompilation does.
If assets are not precompiled before deployment, browsers may serve old cached CSS files, so changes won't appear.
Which option correctly references an image named logo.png stored in app/assets/images within a Rails view?
Think about the helper that generates an <img> tag with the correct path.
image_tag generates an <img> tag with the correct asset path and fingerprinting support.
Given the following ERB code in a Rails production environment with assets precompiled:
<%= asset_path 'application.js' %>
What is the expected output format?
<%= asset_path 'application.js' %>Consider how Rails fingerprints assets in production for caching.
In production, Rails appends a fingerprint hash to asset filenames for cache busting, so the path includes a hash like application-9a8b7c6d5e4f3.js.