aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/tasks/routes.rake
diff options
context:
space:
mode:
Diffstat (limited to 'railties/lib/rails/tasks/routes.rake')
-rw-r--r--railties/lib/rails/tasks/routes.rake12
1 files changed, 10 insertions, 2 deletions
diff --git a/railties/lib/rails/tasks/routes.rake b/railties/lib/rails/tasks/routes.rake
index a0c953967c..0c26bcf790 100644
--- a/railties/lib/rails/tasks/routes.rake
+++ b/railties/lib/rails/tasks/routes.rake
@@ -10,8 +10,16 @@ task :routes => :environment do
routes = all_routes.collect do |route|
reqs = route.requirements.dup
- reqs[:to] = route.app unless route.app.class.name.to_s =~ /^ActionDispatch::Routing/
- reqs = reqs.empty? ? "" : reqs.inspect
+ rack_app = route.app unless route.app.class.name.to_s =~ /^ActionDispatch::Routing/
+
+ endpoint = rack_app ? rack_app.inspect : "#{reqs[:controller]}##{reqs[:action]}"
+ constraints = reqs.except(:controller, :action)
+
+ reqs = endpoint == '#' ? '' : endpoint
+
+ unless constraints.empty?
+ reqs = reqs.empty? ? constraints.inspect : "#{reqs} #{constraints.inspect}"
+ end
{:name => route.name.to_s, :verb => route.verb.to_s, :path => route.path, :reqs => reqs}
end