4 Routes


#1

I have no clue on what to do here..... Please HELP !

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'


#2

Error when I type get 'welcome' +> 'pages#home' under line # 1 in editior

Oops! The test returned an error. Maybe you have a syntax error, or a typo. Hide error.
app/controllers/pages_controller.rb:2:in <class:PagesController>': undefined methodget' for PagesController:Class (NoMethodError)


#3

I'm getting the same error. I can get to 'routes.rb' not 'config/routes.rb' its really weird. becasue routes.rb doesn't fall under config


#4

I am getting this. Did you find a solution?


#5

Insert this and you get it working!
1. Rails.application.routes.draw do
2.get 'welcome' => 'pages#home'


#6

whats the difference in it ?


#7

I'm still getting a syntax error....not sure what to do to proceed

Oops! The test returned an error. Maybe you have a syntax error, or a typo. Hide error.
app/controllers/pages_controller.rb:1:in `': uninitialized constant ApplicationControlle (NameError)


#8

'pages#home' letter p of pages is not capital it must be written a small letter


#10

solution

When in File Navigator, Don't go to "config.ru"... instead open the file "congif" then "routes.rb .

after opening you'll find a line "Rails.application.routes.draw do" and a lot pf grey lines, ignore them and type under the first line "the line with colors" the code given in the instructions.

hope it works for you.


#11

@landen_lewis

Just to specify:

In routes.rb, when we type

get 'welcome' => 'pages#home'

We are telling if we access to http://localhost/welcome we enter inside home.html.erb inside the pages folder. The # is used for separating the folder and the file. In basic routes allow us to manipulate url and change them easily.