TL;DR
- API モードで構築した Rails アプリケーションでは、アクションで
renderかredirect_toを呼ばないと、204 No Content が返る。
検証
API モードで構築した Rails アプリケーションでは、ApplicationController が ActionController::API を継承する。Rails のガイドには、次のように書かれている。
Keep in mind that templates are not going to be rendered, so you need to ensure your controller is calling either render or redirect_to in all actions, otherwise it will return 204 No Content.
API モードではテンプレートが描画されないので、すべてのアクションで render か redirect_to を呼ばないと、HTTP のステータスコード 204 No Content が返る。