Skip to main content
Ask A Question
Notifications
You’re not receiving notifications from this thread.
Subscribe

Why doesn't my app show on my browser when running locally?

Rails • Asked by vkuz91

I'm new to rails and trying to display a very simple app from codecademy which results in this error on my browser:

PagesController#welcome is missing a template for request formats: text/html

NOTE! Unless told otherwise, Rails expects an action to render a template with the same name, contained in a folder named after its controller. If this controller is an API responding with 204 (No Content), which does not require a template, then this error will occur when trying to access it via browser, since we expect an HTML template to be rendered for such requests. If that’s the case, carry on.

Here are the files:

pages_controller.rb

class PagesController < ApplicationController
def welcome
end
end

routes.rb

Rails.application.routes.draw do
root ‘pages#welcome’
end

I'm running 'rails server' and getting the above error in my browser. As far as I can tell the files are in the right place (app/view/pages/welcome.html.erb) and of the right type. Rails v 6.0.1.


Login or Create An Account to join the conversation.

Subscribe to the newsletter

Join 31,575+ developers who get early access to new screencasts, articles, guides, updates, and more.

    By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

    More of a social being? We're also on Twitter and YouTube.