Performance: Route definition in routes.rb
MEDIUM IMPACT
This affects the initial server response time and client navigation speed by determining how requests are matched to controller actions.
Rails.application.routes.draw do resources :posts end
Rails.application.routes.draw do get '/posts/index', to: 'posts#index' get '/posts/show/:id', to: 'posts#show' get '/posts/new', to: 'posts#new' post '/posts/create', to: 'posts#create' get '/posts/edit/:id', to: 'posts#edit' patch '/posts/update/:id', to: 'posts#update' delete '/posts/destroy/:id', to: 'posts#destroy' end
| Pattern | Route Table Size | Matching Time | Server Response Impact | Verdict |
|---|---|---|---|---|
| Manual individual routes | Large | High (linear with routes) | Slower LCP due to longer routing | [X] Bad |
| Resourceful routes | Compact | Low | Faster LCP with efficient routing | [OK] Good |