Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

push is_a check up to where the Constraints object is allocated

  • Loading branch information...
commit 605ab030a9a8fd8ce77ee20ab246875f958c551f 1 parent b18f22d
@tenderlove tenderlove authored
View
2  actionpack/lib/action_dispatch/routing/inspector.rb
@@ -16,7 +16,7 @@ def rack_app
@rack_app ||= begin
endpoint = app.app
- if ActionDispatch::Routing::Redirect === endpoint || !app.dispatcher?
+ if app.redirect? || !app.dispatcher?
endpoint
end
end
View
15 actionpack/lib/action_dispatch/routing/mapper.rb
@@ -18,7 +18,7 @@ class Mapper
class Constraints #:nodoc:
attr_reader :app, :constraints
- def initialize(app, constraints, request, dispatcher_p)
+ def initialize(app, constraints, request, dispatcher_p, redirect_p)
# Unwrap Constraints objects. I don't actually think it's possible
# to pass a Constraints object to this constructor, but there were
# multiple places that kept testing children of this object. I
@@ -28,12 +28,14 @@ def initialize(app, constraints, request, dispatcher_p)
app = app.app
end
- @dispatcher = dispatcher_p
+ @dispatcher = dispatcher_p
+ @redirect = redirect_p
@app, @constraints, @request = app, constraints, request
end
def dispatcher?; @dispatcher; end
+ def redirect?; @redirect; end
def matches?(req)
@constraints.all? do |constraint|
@@ -218,21 +220,24 @@ def normalize_conditions!
end
def app
+ dispatcher_p = false
+ redirect = false
+
# Unwrap any constraints so we can see what's inside for route generation.
# This allows the formatter to skip over any mounted applications or redirects
# that shouldn't be matched when using a url_for without a route name.
if to.respond_to?(:call)
- dispatcher_p = false
endpoint = to
+ redirect = Redirect === endpoint
else
dispatcher_p = true
endpoint = dispatcher
end
if blocks.any?
- Constraints.new(endpoint, blocks, @set.request_class, dispatcher_p)
+ Constraints.new(endpoint, blocks, @set.request_class, dispatcher_p, redirect)
else
- Constraints.new(endpoint, blocks, @set.request_class, dispatcher_p)
+ Constraints.new(endpoint, blocks, @set.request_class, dispatcher_p, redirect)
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.