railstutorial ruby on rails Missing template in tutorial

Viewed 5060

I'm in the very beginning of my career as a Ruby on Rails developer I'm reading online a book named "Ruby on Rails Tutorial (Rails 5) Learn Web Development with Rails" I've made an 'hello world' app following the book instructions.

app/controllers/application_controller.rb

class ApplicationController < ActionController::Base

  protect_from_forgery with: :exception

  def hello
    render text: "hello world!"
  end

end

config/routes.rb

Rails.application.routes.draw do

  root 'application#hello'

end

Now I receive that error

Missing template application/hello with {:locale=>[:en], :formats=>[:html], :variants=>[], :handlers=>[:raw, :erb, :html,

:builder, :ruby, :coffee, :jbuilder]}. Searched in: app_path/app/views

I have

/app/view/layouts/application.html.erb

in my project so that should theoretically be the view, shouldn't it?

So am I missing something? How could I fix it?

3 Answers
render html: "hello, world!"

will do the job

Related