Recall & Review
beginner
What is the purpose of the
public folder in a Rails application?The
public folder holds static files like images, robots.txt, and favicon.ico that are served directly by the web server without going through Rails.Click to reveal answer
beginner
Where should you put CSS, JavaScript, and image files that need preprocessing in Rails?
These files belong in the
app/assets folder because Rails processes them with tools like the asset pipeline before serving.Click to reveal answer
intermediate
How does Rails handle files in the
public folder differently from those in app/assets?Files in
public are served as-is, no processing. Files in app/assets are compiled, minified, and fingerprinted by the asset pipeline before serving.Click to reveal answer
intermediate
What is the benefit of fingerprinting assets in Rails?
Fingerprinting adds a unique hash to filenames to help browsers cache assets efficiently and update them only when the file changes.
Click to reveal answer
beginner
Can you put dynamic Ruby code inside files in the
public folder?No. Files in
public are static and served directly. Dynamic Ruby code belongs in views or helpers, not in public.Click to reveal answer
Which folder in Rails is used for static files served without processing?
✗ Incorrect
The
public folder holds static files served directly by the web server.Where do you place JavaScript files that need to be compiled by Rails?
✗ Incorrect
JavaScript files that need preprocessing go in
app/assets.What does fingerprinting in Rails asset pipeline help with?
✗ Incorrect
Fingerprinting helps browsers cache assets and update them only when they change.
Can you put ERB (Ruby code) inside files in the
public folder?✗ Incorrect
Files in
public are static and not processed by Rails.Which folder is best for storing images that need to be optimized by Rails?
✗ Incorrect
Images in
app/assets/images are processed by the asset pipeline.Explain the difference between the
public folder and the app/assets folder in Rails.Think about how files are served and processed.
You got /4 concepts.
Why is fingerprinting important for assets in Rails? How does it affect caching?
Consider how browsers decide to use cached files or fetch new ones.
You got /4 concepts.