LoginSignup
0
0

More than 3 years have passed since last update.

rails Controllerについてまとめてみた

Posted at

初心者がController についてアウトプットをかねてまとめます。
*訂正あれば是非お願い致します。

Controller

Controllerの生成
Controller名はモデルの複数形
ex) Messageモデルなら Messages

rails g controller コントローラ名 --(オプションがあれば)

生成されるファイル↓(messagesの部分は例として)
app/controllers/messages_controller.rb
↓のようなの書き方をする

class MessagesController < ApplicationController
    def index
    end

    def show
    end

    def new
    end

    def create
    end

    def edit
    end

    def update
    end

    def destroy
    end
end

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