Performance: App folder organization
This affects page load speed and rendering by influencing how quickly the server can locate and serve code and assets.
app/
controllers/
users_controller.rb
products_controller.rb
models/
user.rb
product.rb
views/
users/
index.html.erb
products/
index.html.erb
helpers/
users_helper.rb
products_helper.rb
assets/
images/
stylesheets/
javascripts/
lib/
services/
payment_service.rb
concerns/
user_concern.rb
jobs/
email_job.rbapp/
controllers/
users_controller.rb
products_controller.rb
models/
user.rb
product.rb
views/
users/
index.html.erb
products/
index.html.erb
helpers/
users_helper.rb
products_helper.rb
assets/
images/
stylesheets/
javascripts/
lib/
custom_code.rb
extra_code.rb| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Disorganized folders with mixed code | N/A | N/A | N/A | [X] Bad |
| Organized folders following Rails conventions | N/A | N/A | N/A | [OK] Good |
app/ folder in a Rails application?app/ folderapp/ folder is designed to organize the main parts of the Rails app code by their function.app/app/, not backups or static files.app/ should contain the code that responds to user requests?controllers folder contains this code, while models manage data and views display content.app/: app/models/user.rb, app/controllers/users_controller.rb, app/views/users/index.html.erbusers_controller.rb?users_controller.rb is inside the controllers folder, so it handles requests.app/models/. What problem will this cause?app/views/ to render them properly.app/models/, Rails will not find it and won't render it.app/views/ -> Option Aapp/ folder structure?app/mailers/ folder for mailer classes that send emails.app/mailers/ because mailers have their own folder -> Option BPass the test and this pattern moves unknown