LoginSignup
0
0

More than 1 year has passed since last update.

Model-View-Contoroller(MVC)メモ

Last updated at Posted at 2022-01-07

アクション名とアプリケーションネームは同じ名前にする

していないとプレビューで
The action 'hello' could not be found for ApplicationController
と表示される。

application_controller.rb
class ApplicationController < ActionController::Base

  def hello #ここ
    render html: "hello, world!"
  end
end
routes.rb
Rails.application.routes.draw do
  # For details on the DSL available within this file,
  # see https://guides.rubyonrails.org/routing.html
  root 'application#hello' #ここ
end

これによってapplication_controllerのhelloアクションにルーティングされる。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0