Skip to content

Commit 480d19f

Browse files
committed
Add guards in boot#start
1 parent 35d2a5a commit 480d19f

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

lib/dry/rails/boot/controller_helpers.rb

+5-2
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@
66
end
77

88
start do
9-
ApplicationController.include(Dry::Rails::Features::ControllerHelpers)
9+
unless ApplicationController.include?(Dry::Rails::Features::ControllerHelpers)
10+
ApplicationController.include(Dry::Rails::Features::ControllerHelpers)
11+
end
1012

11-
if defined?(ActionController::API)
13+
if defined?(ActionController::API) &&
14+
!ActionController::API.include?(Dry::Rails::Features::ControllerHelpers)
1215
ActionController::API.include(Dry::Rails::Features::ControllerHelpers)
1316
end
1417
end

lib/dry/rails/boot/safe_params.rb

+5-2
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@
66
end
77

88
start do
9-
ActionController::Base.include(Dry::Rails::Features::SafeParams)
9+
unless ActionController::Base.include?(Dry::Rails::Features::SafeParams)
10+
ActionController::Base.include(Dry::Rails::Features::SafeParams)
11+
end
1012

11-
if defined?(ActionController::API)
13+
if defined?(ActionController::API) &&
14+
!ActionController::API.include?(Dry::Rails::Features::SafeParams)
1215
ActionController::API.include(Dry::Rails::Features::SafeParams)
1316
end
1417
end

0 commit comments

Comments
 (0)