Ruby On Rails Classroom image

Anil  Bist / Professional / 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
Anil  Bist

Skills    Ruby On Rails

Qualifications :- High School - SLV, College/University - Graphic Era Deemed Univ University,
Location :-Dehradun,Dehradun,Uttarakhand,India
Description:-

I started my Professional Journey in 2006 with one of the Web Development Company in Bangalore and my 1st framework was "Ruby on Rail" as Web development and delivered around 5+ Projects using this platform. Then came another dimension as JEE/Sturst framework, Gradually I realized that I want to build something on my own and give my passion and energy on creating something different a
Explore

 

  Students (0)