Skip to content
Browse files

Constraints contructor should always return a Constraints object

I know, it's crazy.
  • Loading branch information...
1 parent 2b7b136 commit cf2a40b8ac372b81b2bb6d755705485ca51d2925 @tenderlove tenderlove committed May 23, 2014
Showing with 5 additions and 9 deletions.
  1. +5 −9 actionpack/lib/action_dispatch/routing/mapper.rb
View
14 actionpack/lib/action_dispatch/routing/mapper.rb
@@ -16,14 +16,6 @@ class Mapper
:shallow, :blocks, :defaults, :options]
class Constraints #:nodoc:
- def self.new(app, constraints, request)
- if constraints.any?
- super(app, constraints, request)
- else
- app
- end
- end
-
attr_reader :app, :constraints
def initialize(app, constraints, request)
@@ -215,7 +207,11 @@ def normalize_conditions!
end
def app
- Constraints.new(endpoint, blocks, @set.request_class)
+ if blocks.any?
+ Constraints.new(endpoint, blocks, @set.request_class)
+ else
+ endpoint
+ end
end
def default_controller_and_action

0 comments on commit cf2a40b

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