diff options
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r-- | actionpack/lib/action_controller/metal.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/actionpack/lib/action_controller/metal.rb b/actionpack/lib/action_controller/metal.rb index d68fa16847..54980aa453 100644 --- a/actionpack/lib/action_controller/metal.rb +++ b/actionpack/lib/action_controller/metal.rb @@ -259,5 +259,15 @@ module ActionController lambda { |env| new.dispatch(name, ActionDispatch::Request.new(env)) } end end + + # Direct dispatch to the controller. Instantiates the controller, then + # executes the action named +name+. + def self.dispatch(name, req) + if middleware_stack.any? + middleware_stack.build(name) { |env| new.dispatch(name, req) }.call req.env + else + new.dispatch(name, req) + end + end end end |