Problem using render text in basic rails application

It works fine as far as this

C:\blah>rails new test1

C:\blah\test1>rails server

I edit application_controller.rb

I add a function called hello

def hello

render plain: “aasdf”


I edit the routes.rb file

I add this line into the existing procedure within routes.rb root ‘application#hello’

I access and it shows aasdf

So that’s all fine

But here’s the problem

If I edit application_controller.rb and change that line from render plain: “aasdf” into render text: “hello world!” then it doesn’t work. Though suggests using render text: “hello world!”. in the application controller hello procedure.


def hello

render text: “hello world!”


I get the error "

Missing template application/hello with {:locale=>[:en], :formats=>[:html], :variants=>[], :handlers=>[:raw, :erb, :html, :builder, :ruby, :coffee, :jbuilder]}. Searched in: * “C:/blah/test1/app/views”"

And if I change it to one suggestion regarding that kind of error, that I saw online, the suggesetion is to add a parameter of content_type: ‘text/plain’ i.e.

def hello

render text: “hello world!”, content_type: ‘text/plain’


Then I get the same error

Where am I going wrong here?


render text: is deprecated. Stick with render plain: .