生じた現象
- formを入力してPOST送信をして返ってきたレスポンスのHTMLが、ブラウザでレンダリングされなかった。
対策
form_with(model: @form, local: true) do |f|
# inputたち
end
のように、local: true
指定してやれば良い。
参考
- https://stackoverflow.com/a/50647776 によると、以下。
Forms generated with form_with by default has data-remote set to true.
If the data-remote is set to true your form makes an AJAX call. So your view is getting rendered as the response of that AJAX call. That is why you are not getting any errors.
Add local: true in your form_with.