0
0

More than 1 year has passed since last update.

【Rails API】手動でコントローラを追加する方法【備忘録】

Last updated at Posted at 2022-12-17
  1. api/v1/examples_controller.rb を作成
  2. config/routes.rbにresourcesを追加(ルーティングを追加する)
  3. index アクションなどを作成
  4. http://localhost:3000/api/v1/examples?parameter=1
##チェンジディレクトリ
cd controller/api/v1

##ファイル作成
touch example_controller.rb

自動で作成する場合(scssファイルとhelperファイルが不要な場合はオプションをつける)

rails g controller api/v1/examples index create --no-assets --no-helper
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