2024.08.14(水) / 12:53

posts/indexにアクセスした時の挙動

最終更新
2026.06.06
タグ

http://localhost:3000/posts/index にアクセスすると、以下の表示になる。

ルーティング

config/routes.rb には、以下の記述がある。

これは、/posts/indexにアクセスした時に、postsコントローラのindexアクションが動作しますよという意味。

postsコントローラのindexアクション

以下のような記述である。