Follow 3 steps to add a root route to your Rails app.

Replace "Yay! You’re on Rails"

Problem: Want a have a fancy landing page.

Solution:

  1. Go to route.rb and add the following line of code.

    root to: "main#index"
    
  2. Go to cmd and use this command to generate main controller.

    rails generate controller Main
    

    paste following code in app/controllers/main_controller.rb

    def index
    end
    
  3. Go to /view/main and create a file named index.htm.erb. Paste following HTML

    <h1>Hello world!</h1>
    

That's it.

Join me on Twitter @ThatJsDev