Skip to content
Browse files

skip the build business if the stack is empty

  • Loading branch information...
1 parent 02a9401 commit 40514aa23a6e74b576f6d2e4983bb71e0cc893b0 @tenderlove tenderlove committed May 26, 2014
Showing with 6 additions and 2 deletions.
  1. +6 −2 actionpack/lib/action_controller/metal.rb
View
8 actionpack/lib/action_controller/metal.rb
@@ -227,8 +227,12 @@ def self.call(env)
# Returns a Rack endpoint for the given action name.
def self.action(name, klass = ActionDispatch::Request)
- middleware_stack.build(name.to_s) do |env|
- new.dispatch(name, klass.new(env))
+ if middleware_stack.any?
+ middleware_stack.build(name.to_s) do |env|
+ new.dispatch(name, klass.new(env))
+ end
+ else
+ lambda { |env| new.dispatch(name, klass.new(env)) }
end
end

0 comments on commit 40514aa

Please sign in to comment.
Something went wrong with that request. Please try again.