mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Remove deprecated ActionController::Metal.call
This commit is contained in:
parent
bf81a1cfd8
commit
836811d22d
3 changed files with 11 additions and 17 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
* Remove deprecated `ActionController::Metal.call`.
|
||||||
|
|
||||||
|
*Rafael Mendonça França*
|
||||||
|
|
||||||
* Remove deprecated `ActionController::Metal#env`.
|
* Remove deprecated `ActionController::Metal#env`.
|
||||||
|
|
||||||
*Rafael Mendonça França*
|
*Rafael Mendonça França*
|
||||||
|
|
|
@ -227,14 +227,6 @@ module ActionController
|
||||||
middleware_stack
|
middleware_stack
|
||||||
end
|
end
|
||||||
|
|
||||||
# Makes the controller a Rack endpoint that runs the action in the given
|
|
||||||
# +env+'s +action_dispatch.request.path_parameters+ key.
|
|
||||||
def self.call(env)
|
|
||||||
req = ActionDispatch::Request.new env
|
|
||||||
action(req.path_parameters[:action]).call(env)
|
|
||||||
end
|
|
||||||
class << self; deprecate :call; end
|
|
||||||
|
|
||||||
# Returns a Rack endpoint for the given action name.
|
# Returns a Rack endpoint for the given action name.
|
||||||
def self.action(name)
|
def self.action(name)
|
||||||
if middleware_stack.any?
|
if middleware_stack.any?
|
||||||
|
|
|
@ -238,7 +238,7 @@ module ActionDispatch
|
||||||
options[:controller] ||= /.+?/
|
options[:controller] ||= /.+?/
|
||||||
end
|
end
|
||||||
|
|
||||||
if to.respond_to? :call
|
if to.respond_to?(:action) || to.respond_to?(:call)
|
||||||
options
|
options
|
||||||
else
|
else
|
||||||
to_endpoint = split_to to
|
to_endpoint = split_to to
|
||||||
|
@ -290,16 +290,14 @@ module ActionDispatch
|
||||||
end
|
end
|
||||||
|
|
||||||
def app(blocks)
|
def app(blocks)
|
||||||
if to.is_a?(Class) && to < ActionController::Metal
|
if to.respond_to?(:action)
|
||||||
Routing::RouteSet::StaticDispatcher.new to
|
Routing::RouteSet::StaticDispatcher.new to
|
||||||
|
elsif to.respond_to?(:call)
|
||||||
|
Constraints.new(to, blocks, Constraints::CALL)
|
||||||
|
elsif blocks.any?
|
||||||
|
Constraints.new(dispatcher(defaults.key?(:controller)), blocks, Constraints::SERVE)
|
||||||
else
|
else
|
||||||
if to.respond_to?(:call)
|
dispatcher(defaults.key?(:controller))
|
||||||
Constraints.new(to, blocks, Constraints::CALL)
|
|
||||||
elsif blocks.any?
|
|
||||||
Constraints.new(dispatcher(defaults.key?(:controller)), blocks, Constraints::SERVE)
|
|
||||||
else
|
|
||||||
dispatcher(defaults.key?(:controller))
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue