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 cc7d5ed
Showing 1 changed file with 6 additions and 1 deletion.
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

0 comments on commit cc7d5ed

Please sign in to comment.