0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

コントローラーとビューを同時に作成

Last updated at Posted at 2020-11-25

#コントローラーとビューを同時に作成

####作成方法
% rails g controller 'コントローラー名/ビューのファイルの名前' index

(例) % rails g controller tests index

  • testsコントローラーにindexアクションが作られる
  • viewsのtestsフォルダにindex.html.erbファイルが作られる

以下の方法を取ると、オプションとして指定したアクションの定義と、
アクションに紐付いたビューファイルが作成できます。
(例)% rails g controller test index new

  • app/controllers/tests_controller.rb
  • app/views/tests/index.html.erb
  • app/views/tests/new.html.erb

が作成されます。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?