Learn
Great! We created a new controller named Pages. How did we do this?
- The
rails generate controller Pages
command generated a new controller named Pages. This created a file named app/controllers/pages_controller.rb. - Inside the new Pages controller, we added a method called
home
. Methods in Rails controllers are also referred to as controller actions, so here we added thehome
action to the Pages controller.
Instructions
1.
Now that we have a controller, let’s move on to the second part of the request/response cycle and create a route.
Open config/routes.rb and underneath line 1, type:
get 'welcome' => 'pages#home'
Sign up to start coding
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.