Routing in Rails
Routing in Rails
Routing in Rails is handled by the config/routes.rb
file. It maps URLs to controller actions.
- Basic Route:
get '/welcome', to: 'pages#welcome'
- Resources:
resources :articles
automatically creates RESTful routes. - Root Route:
root 'home#index'
sets the homepage.
Use rails routes
to view all available routes.