Skip to content

Commit 836811d

Browse files
committed
Remove deprecated ActionController::Metal.call
1 parent bf81a1c commit 836811d

File tree

3 files changed

+11
-17
lines changed

3 files changed

+11
-17
lines changed

actionpack/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
* Remove deprecated `ActionController::Metal.call`.
2+
3+
*Rafael Mendonça França*
4+
15
* Remove deprecated `ActionController::Metal#env`.
26

37
*Rafael Mendonça França*

actionpack/lib/action_controller/metal.rb

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -227,14 +227,6 @@ def self.middleware
227227
middleware_stack
228228
end
229229

230-
# Makes the controller a Rack endpoint that runs the action in the given
231-
# +env+'s +action_dispatch.request.path_parameters+ key.
232-
def self.call(env)
233-
req = ActionDispatch::Request.new env
234-
action(req.path_parameters[:action]).call(env)
235-
end
236-
class << self; deprecate :call; end
237-
238230
# Returns a Rack endpoint for the given action name.
239231
def self.action(name)
240232
if middleware_stack.any?

actionpack/lib/action_dispatch/routing/mapper.rb

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ def normalize_options!(options, path_params, modyoule)
238238
options[:controller] ||= /.+?/
239239
end
240240

241-
if to.respond_to? :call
241+
if to.respond_to?(:action) || to.respond_to?(:call)
242242
options
243243
else
244244
to_endpoint = split_to to
@@ -290,16 +290,14 @@ def normalize_defaults(options)
290290
end
291291

292292
def app(blocks)
293-
if to.is_a?(Class) && to < ActionController::Metal
293+
if to.respond_to?(:action)
294294
Routing::RouteSet::StaticDispatcher.new to
295+
elsif to.respond_to?(:call)
296+
Constraints.new(to, blocks, Constraints::CALL)
297+
elsif blocks.any?
298+
Constraints.new(dispatcher(defaults.key?(:controller)), blocks, Constraints::SERVE)
295299
else
296-
if to.respond_to?(:call)
297-
Constraints.new(to, blocks, Constraints::CALL)
298-
elsif blocks.any?
299-
Constraints.new(dispatcher(defaults.key?(:controller)), blocks, Constraints::SERVE)
300-
else
301-
dispatcher(defaults.key?(:controller))
302-
end
300+
dispatcher(defaults.key?(:controller))
303301
end
304302
end
305303

0 commit comments

Comments
 (0)