LoginSignup
3
0

RailsのAPI用のControllerをつくる

Last updated at Posted at 2021-10-05

#RailsのAPI用のコントローラーをつくる
備忘録です。

  • api/v1/mobile/以下にdictionaries_controller.rbを作成したい。
  • jsやviewやhelperを作成したくない。

場合のコントローラーの生成方法です。

rails g controller api::v1::mobile::dictionaries --no-helper --no-assets --no-view-specs --skip-template-engine

またAPI用のコントローラーを生成したあとは、ApplicationControllerからActionController::APIを継承するように手動で設定し直すことを忘れずに。

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