user5311019
user5311019

Reputation: 93

Template is missing ruby-on-rails

localhost says that template is missing. routes.rb:

 Rails.application.routes.draw do

     root 'home#index'

     resources :sessions,      only: [:new, :create, :destroy]

     get    'signup'   => 'users#new'
     get    'signin'   => 'sessions#new'
     delete 'signout'  => 'sessions#destroy'
     get    'about'    => 'static_pages#about'

     match '*path' => 'application#routing_error', via: :all

 end

nothing in my home_controller.rb

any idea to fix this?

Upvotes: 3

Views: 75

Answers (2)

Yahs Hef
Yahs Hef

Reputation: 797

You probably already have a home folder under view. If not, create the folder. Then add a index.html.erb with a heading like this:

 <h1>Welcome!</h1>

hope this helps

edit You should define and index method too! (not necessary)

Upvotes: 5

ddavison
ddavison

Reputation: 29032

In addition to @YahsHef's answer.. You state that

Nothing in my home_controller.rb

You'll also need the index method to exist.

class HomeController < ApplicationController
  def index
  end
end

in order to render the view.

Upvotes: 4

Related Questions