LoginSignup
1
0

More than 3 years have passed since last update.

【RubyOnRails】Controller生成

Last updated at Posted at 2019-09-24

この記事の概要

・RubyOnRailsについて、Progateで学んだことを書き記す
・ガチ初心者によるもの
・主に備忘録として、随時書き足していく

項目

Controllerの生成

ターミナルで、以下のコマンドを実行
rails generate controller [コントローラー名] [アクション名]

結果)
①ルーティングが自動で追加される
②Controller、Viewが自動で生成される
ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー
①の詳細)
rails generate controller examples index
⇒作業ディレクトリ/config/routes.rbに、

get "examples/index" => "examples#index"

の一行が自動追加される。

②の詳細
rails generate controller examples index
⇒作業ディレクトリ/app/controllers/に、
examples_controller.rb が生成される

⇒作業ディレクトリ/app/views/に、
/examples/index.html.erb
が生成される

1
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
1
0