I'm creating a Rails 4.2 app to print "Hello World" on a web page. But what I get while running the page is this error:
Unknown action The action 'hello' could not be found for ApplicationController
These are the files I updated:
application_controller.rb
class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
def hello
render text: "hello, world!"
end
end
routes.rb
Rails.application.routes.draw do
# You can have the root of your site routed with "root"
root 'application#hello'
end