Permalink
Browse files

refactor Routing::Mapper

  • Loading branch information...
1 parent ef61504 commit 77f2ba9559ff53987ce3e026f33275678617768e @goshakkk goshakkk committed Jan 3, 2013
Showing with 4 additions and 9 deletions.
  1. +4 −9 actionpack/lib/action_dispatch/routing/mapper.rb
View
13 actionpack/lib/action_dispatch/routing/mapper.rb
@@ -26,15 +26,10 @@ def initialize(app, constraints, request)
def matches?(env)
req = @request.new(env)
- @constraints.each { |constraint|
- if constraint.respond_to?(:matches?) && !constraint.matches?(req)
- return false
- elsif constraint.respond_to?(:call) && !constraint.call(*constraint_args(constraint, req))
- return false
- end
- }
-
- return true
+ @constraints.none? do |constraint|
+ (constraint.respond_to?(:matches?) && !constraint.matches?(req)) ||
+ (constraint.respond_to?(:call) && !constraint.call(*constraint_args(constraint, req)))
+ end
ensure
req.reset_parameters
end

1 comment on commit 77f2ba9

@batiste

This commit changed the behaviour somehow. We use to have nil constraints that returned true (a config) and now with this nil returns false.

Please sign in to comment.