Skip to Content
Learn
Getting Started
Views

Well done! Now when a user visits http://localhost:8000/welcome, the route

get 'welcome' => 'pages#home'

will tell Rails to send this request to the Pages controller’s home action.

Instructions

1.

Now that we have a controller and a route, let’s move on to the third part of the request/response cycle and create a view.

Open app/views/pages/home.html.erb, and type in the following HTML. Fill in your own name.

<div class="main"> <div class="container"> <h1>Hello my name is __</h1> <p>I make Rails apps.</p> </div> </div>

We’ve provided CSS in the file app/assets/stylesheets/pages.css.scss.

2.

View your app by visiting http://localhost:8000/welcome in the browser.

Folder Icon

Sign up to start coding

Already have an account?