Skip to content

Commit d64d1ea

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

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

lib/dry/rails/boot/controller_helpers.rb

+4-2
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
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) && !ActionController::API.include?(Dry::Rails::Features::ControllerHelpers)
1214
ActionController::API.include(Dry::Rails::Features::ControllerHelpers)
1315
end
1416
end

lib/dry/rails/boot/safe_params.rb

+4-2
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
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) && ! ActionController::API.include?(Dry::Rails::Features::SafeParams)
1214
ActionController::API.include(Dry::Rails::Features::SafeParams)
1315
end
1416
end

0 commit comments

Comments
 (0)