โ Ruby on Rails learning pathRuby on Rails ยท Module 2 of 10
Routes and controllers
Routes map URLs to controller actions.
๐ Key ideas
- config/routes.rb defines routes.
- resources :products creates the 7 RESTful routes (index, show, new, create, edit, update, destroy).
- A controller action handles one request and renders a view or redirects.
- params holds URL and form values.
- bin/rails routes lists every route.
๐ก Real-life example: Like a school reception desk: the route says which room handles your request, and the controller is the teacher in that room.
routes.rbFile that maps URLs to actions
resourcesCreates the standard REST routes
paramsRequest parameters
ActionA controller method that handles a request