Ruby On Rails Classroom image

Pooja  Negi / Student / Web Technology

 
To post your Question Join Classroom
 
Lesson Topics's No:-  First|1 | 2|
Lessons:-Rails Routes

Listing 5.22 The commented-out hint for defining the root route.
config/routes.rb

 

                          

 

Using Listing 5.22 as a model, we arrive at Listing 5.23 to route the root URI / to the Home page.

 

Listing 5.23 Adding a mapping for the root route.
config/routes.rb

 

                                             

 

This code maps the root URI / to /static pages/home, and also gives URI helpers as follows:

 

root path    =>    '/'
root url     =>    'http://localhost:3000/'

 

We should also heed the comment in Listing 5.22 and delete public/index.html to prevent Rails from rendering the default page (Figure 1.3) when we visit /. You can of course simply remove the file by trashing it, but if you’re using Git for version control there’s a way to tell Git about the removal at the same time using git rm:

 

git  rm  public / index .html

 

With that, all of the routes for static pages are working, and the tests should pass:


$  bundle  exec  rspec  spec/requests/static  pages  spec.rb 

 

Now we just have to fill in the links in the layout. 

 
 
 
image
Pooja   Negi

Skills    Ruby On Rails

Qualifications :- High School - SSN high school, College/University - HNBGU, College/University - SRHU,
Location :-Ranipokhari,Rishikesh,Uttarakhand,India
Description:- Student
Explore
 

  Students (0)