ยง2023-03-04

1.2.4 Hello, world!

Controller actions are defined inside controllers. At this point the Application controller is the only controller we have, which you can verify by running

(FRUM) [alexlai@n2MnJaro hello_app]$ ls app/controllers/*_controller.rb
app/controllers/application_controller.rb
class ApplicationController < ActionController::Base
end
class ApplicationController < ActionController::Base

  def hello
    render html: "hello, world!"
  end
end
Rails.application.routes.draw do
  # Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html

  # Defines the root path route ("/")
  # root "articles#index"
end
Rails.application.routes.draw do
  # Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html

  # Defines the root path route ("/")
  # root "articles#index"
  root "application#hello"
end