Skip to content

Commit

Permalink
Include Rack::MethodOverride middleware for API only apps
Browse files Browse the repository at this point in the history
Otherwise POST requests with _method set to something else won't work.
  • Loading branch information
rosa committed Nov 13, 2024
1 parent d6764c7 commit 6adccae
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
7 changes: 6 additions & 1 deletion lib/mission_control/jobs/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@ module Jobs
class Engine < ::Rails::Engine
isolate_namespace MissionControl::Jobs

config.middleware.use ActionDispatch::Flash unless config.action_dispatch.flash
initializer "mission_control-jobs.middleware" do |app|
if app.config.api_only
app.middleware.use ActionDispatch::Flash
app.middleware.use ::Rack::MethodOverride
end
end

config.mission_control = ActiveSupport::OrderedOptions.new unless config.try(:mission_control)
config.mission_control.jobs = ActiveSupport::OrderedOptions.new
Expand Down
1 change: 0 additions & 1 deletion test/dummy/config/application.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
require_relative "boot"

require "rails/all"
require "propshaft"

require "resque"
require "solid_queue"
Expand Down

0 comments on commit 6adccae

Please sign in to comment.