When I typed the code below in
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
render html: "hello, world!"
and the code below in
The root route still returns the default Rails page while I was expecting it would return "hello, world!". Please help me with this small issue.
I just built a test app and used your code above...it worked great! I went to
http://localhost:3000 and successfully got the "hello, world!" message.
What version of rails are you using?
What happens when you run
rake routes (or
rails routes if you're on 5+) from the command line? Mine looks like this:
$ rake routes Prefix Verb URI Pattern Controller#Action root GET / application#hello
Note - you might need to restart your rails server depending on how you have everything set up but if your server is running on your laptop, the reboot should have handled that.