akr
akr

Reputation: 1

missing template in rails when correct view, controller and route exist

I am trying to create an easy app in rails.

I have a controller:

class PagesController < ApplicationController
  def home
  end
end

I have a view (Broadway/app/views/pages.html.erb)

and I have a route:

Rails.application.routes.draw do
  root to: 'pages#home'
end

but when I start my server at http://localhost:3000/

I get error

PagesController#home is missing a template for this request format and variant. request.formats:

I don't understand what I am doing wrong.

Upvotes: 0

Views: 561

Answers (1)

jvillian
jvillian

Reputation: 20253

Try making Broadway/app/views/pages/home.html.erb. The name of the template should match the name of the controller action. Right now, your template is NOT matching the name of the controller.

Upvotes: 1

Related Questions