Bolt-network Step 7 cannot view the home page


#1

Hello Guys,
I have modified the route.rb file like this

Rails.application.routes.draw do
get ‘pages#home’ =>'pages#home’
route 'pages#home’
route ‘pages#about’

then start view page in step 7 with rails s -p 4001, but nothing happens. Is there any issue to port 4001 or not?

Thanks
Macy


#2

Hi @mhghg,

Could you please give a link to the exercise? I’ll be happy to take a look and see if I can find the problem.


#3

Hello zystvan,
Here is the link for my work

https://www.codecademy.com/courses/learn-rails/projects/learn-rails_bolt-network
and my routes.rb file is

Rails.application.routes.draw do
get ‘/pages/home’ =>'pages#home’
root 'pages#home’
root ‘pages#about’

Thanks,
Macy


#4

You can only have one root, so remove the root 'pages#about' line, and you’ll need to map /about to pages#about.


#5

Hi zystvan,
This is the new file.
Rails.application.routes.draw do
get ‘/pages/home’ =>'pages#home’
root 'pages#home’
get ‘/pages/about’ => ‘pages#about’

if i want to go to the about page, I have to type in url this address : https://localhost:4001/pages/home
Am I correct ?


#6

That looks good, just make sure you have an end at the bottom of the file. You can probably also get rid of the /pages/home route since I don’t think it’s used (leave the other pages#home line though).


#7

Thanks zystvan!
:yum:


#8

This topic is solved.