How to make AbstractController::ActionNotFound post request errors bubble up to page while developing?

Hello,

It seems POST requests that produce AbstractController::ActionNotFound errors don’t bubble up to the page, however GET requests do.

Both POST and GET produce an AbstractController::ActionNotFound error in the logs, except POST requests then immediately do a follow-up GET request and show the page where the request originated from instead of the AbstractController::ActionNotFound (which what I desire for while developing).

I’ve tested this was a sample rails 7 app, with just a basic events model and an events & home controller.

When I click the "Edit" link:

  • the error is logged
  • I get the desired AbstractController::ActionNotFound error page

When I click either "Delete" or "Create" buttons:

  • the error is logged
  • I don’t see the AbstractController::ActionNotFound error on the page (undesired while developing)
  • the page is reloaded
# routes
Rails.application.routes.draw do
  root 'home#index'
  resources :events
end
# app/controllers/events_controller.rb
class EventsController < ApplicationController
  # no methods defined here as I want to produce the errors for demo purposes
end
# app/views/home/index.html.erb

Edit
<% @edit_event = Event.first %>
<%= link_to 'Edit', edit_event_path(@edit_event) %>

Delete
<%= button_to 'Delete', Event.first, method: :delete %>

New Event
<% @new_event = Event.new %>
<%= form_with model: @new_event, url: events_path do |f| %>
    <%= f.submit 'Create' %>
<% end %>

What’s the proper way to have AbstractController::ActionNotFound errors bubble to the page?