1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

the request class is never changed, so just use it directly in the method body

This commit is contained in:
Aaron Patterson 2015-08-07 10:45:55 -07:00
parent 9645820bdb
commit 4485351501
2 changed files with 6 additions and 6 deletions

View file

@ -232,13 +232,13 @@ module ActionController
end end
# Returns a Rack endpoint for the given action name. # Returns a Rack endpoint for the given action name.
def self.action(name, klass = ActionDispatch::Request) def self.action(name)
if middleware_stack.any? if middleware_stack.any?
middleware_stack.build(name) do |env| middleware_stack.build(name) do |env|
new.dispatch(name, klass.new(env)) new.dispatch(name, ActionDispatch::Request.new(env))
end end
else else
lambda { |env| new.dispatch(name, klass.new(env)) } lambda { |env| new.dispatch(name, ActionDispatch::Request.new(env)) }
end end
end end
end end

View file

@ -39,7 +39,7 @@ module ActionDispatch
return [404, {'X-Cascade' => 'pass'}, []] return [404, {'X-Cascade' => 'pass'}, []]
end end
dispatch(controller, params[:action], req.env) dispatch(controller, params[:action], req)
end end
def prepare_params!(params) def prepare_params!(params)
@ -69,8 +69,8 @@ module ActionDispatch
ActiveSupport::Dependencies.constantize(const_name) ActiveSupport::Dependencies.constantize(const_name)
end end
def dispatch(controller, action, env) def dispatch(controller, action, req)
controller.action(action).call(env) controller.action(action).call(req.env)
end end
def normalize_controller!(params) def normalize_controller!(params)