💎 Ruby on Rails
Beginner
What are Rails routes?
Answer
Rails routes, defined in config/routes.rb, map incoming HTTP requests (verb + URL path) to controller actions. resources :posts creates 7 RESTful routes automatically: index, show, new, create, edit, update, destroy. You can define custom routes with get '/about', to: 'pages#about'. Run rails routes to list all routes. Routes also generate named path helpers like posts_path and post_path(@post), making it easy to generate URLs without hardcoding strings.